Getting linker error in Xcode 12
when I am trying to build my large iOS app (hybrid, swift+objc). The application is building fine for real device, but It gives linker error when I am trying to run in Simulator directly with Debug configuration.
I have tried all possible solutions in other post here, but unfortunately it didn't work. Although the error in other post is different. I have checked Build for active architectures only
to YES for Debug configs and NO for Release configs.
Other post error,
building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
My error,
building for iOS Simulator, but linking in object file built for macOS, file for architecture x86_64
How can I resolve this issue? I need to run in both iOS real device and Simulator.
Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions.
While the architecture of the iPhone is already arm64 , Intel used x86_64 simulators. With the new M1 series devices, the simulators also run on the arm64 architecture. Xcode already provides the default architecture build settings that help you build and ship on all the platforms.
CloudKit does not work with Simulator.
Wherever you got your library you should request the library that is compiled for iOS Simulator, not for macOS, although they have the same binary architectures that are returned via lipo -info <file>
.
You can verify that your static (.a) or dynamic library (.dylib) is compiled for iOS Simulator using this command:
otool -l <path-to-library> | grep platform
The output means the following:
platform 7
- iOS Simulator platform 6
- Mac Catalyst platform 4
- watchOS platform 2
- iOS platform 1
- macOSHere is the full definition of the enum for platform
.
Try to add x86_64 in VALID_ARCHS in the User-defined section in Build Settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With