Install .app file on simulator m1

I have a general question that confusing me.

I am on M1 and I can build my app on Xcode (or create an archive) for device. Looking in to derived data I can see Debug-iphones (and simulators) folders, I can get the .app and drag/drop it to the simulator. When trying to run the app the app will crash with error:

EXEC 14 Binary with wrong platform

I understand that it wasn't build for simulators but rather it was build for devices and there fore the crash, but when thinking about it I dont understand why? (at least theoretically it shouldn't crash as it was build for arm64 ). Inspected the binary with lipo it was build for arm64. Comparing the binaries for simulator and device (with otool) I dont see a lot of difference except the rpath.

So how does IOS knows it was build for device and not simulator (wrong platform)? is there a way to add some sort of relaxation (in the end both binaries were build for arm64).

Replies

ok so I can see that the binary for devices is maybe encrypted LC_ENCRYPTION_INFO_64 but in that case the error is not descriptive at all EXEC 14 Binary with wrong platform. and cryptid 0 so maybe it means its probably not encrypted

at least theoretically it shouldn't crash as it was build for arm64

This is a common misconception. There’s a difference between architecture (Arm, Intel, and so on) and platform (iOS, iOS Simulator, macOS, and so on). Code is built for both the architecture and the platform. You can’t run code built for one platform on a different platform.

I talk about this more, include info on how you tell these things apart, in An Apple Library Primer.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"