Xcode12 – building for iOS Simulator, but linking in object file built for macOS, file ‘dir/SomeFile.a’ for architecture x86_64

Published

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.

Source: Ios Questions

Published
Categorised as ios, linker-errors, xcode, xcode12, xcodebuild Tagged , , , ,

Answers

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 – macOS

Here is the full definition of the enum for platform.


Miss Rita Marvin Jr.

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq