After upgrading xcode12,build issus:
ld :building for iOS Simulator, but linking in object file built for iOS, file 'xxx.framework/xxx' for architecture arm64
It can run on iPhone
Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions. Seeing these when trying to create an xcframework for Apple Silicon that supports Mac Catalyst and the iOS Simulator: Both ios-arm64-simulator and ios-x86_64-simulator represent two equivalent library definitions.
The "build active architecture only" setting causes everything except the current Mac's architecture to be ignored (and the current one is of course valid), hiding the problem. Instead, you should look up a row or two in the settings, and change the "Architectures" setting to "Standard".
Simulator menu -> File -> New Simulator. It will show a list of iOS available for the device. 7.
The Build Settings editor no longer includes the Valid Architectures build setting "VALID ARCHS", and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED ARCHS)
Xcode 12 is actually the stepping stone for Apple Silicon which unfortunately is not yet available. But with that platform, we are gonna get arm64 based macOS where simulators will also run on arm64 architecture unlike the present Intel-based x86_64 architecture.
Xcode usually depends on the "Run Destination" to build its libraries/apps. So when a simulator is chosen as the "Run Destination", it builds the app for available simulator architectures and when a device is chosen as the "Run Destination" it builds for the architecture that the device supports (arm*).
xcodebuild, in the Xcode 12+ build system, considers arm64 as a valid architecture for the simulator. So when a simulator is chosen as the run destination, it can potentially try to compile/link your libs/apps against arm64 based simulators as well (not available yet). So it sends clang(++) some -target flag like arm64-apple-ios13.0-simulator in --- format and clang tries to build/link against arm64 based simulator that eventually fails on Intel-based mac.
But xcodebuild tries this only for Release builds. Why? Because, "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" build settings is usually set to "No" for the "Release" configuration only. And that means xcodebuild will try to build all architectural variants of your libs/apps for the selected run destination for release builds. And for the Simulator run destination, it will includes both x86_64 and arm64 now on, since arm64 in Xcode 12+ is also a supported architecture for simulators to support Apple Silicon.
Simply putting, Xcode will fail to build your app anytime it tries the command line, xcodebuild, (which defaults to release build, see the general tab of your project setting) or otherwise in release mode. So a simple workaround to this issue is to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes in your libraries/apps, even for release mode.
Steps to resolve the issue :
Solution 1:
Solution 2:
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