I have an app using a linked and embedded custom framework. The app built properly for iOS devices and simulators until Xcode 12.2. Starting from Xcode 12.3 however, I'm getting the following error:
Building for iOS Simulator, but the linked and embedded framework 'My.framework' was built for iOS + iOS Simulator.
The framework is built for both devices and simulators (as the error actually says) and merged using lipo
, so it should be able to run everywhere without issues.
Am I missing something here? Is there a relevant change in Xcode 12.3?
I'm afraid that this is actually the correct error and the framework shouldn't contain iOS and iOS Simulator code at the same time. Apple tries to force us to use
XCFramework
s for this purpose. They started it in Xcode 11 and just tightened up the restrictions.The only correct way to resolve this is to rebuild the framework as an XCFramework. Which is easy to do:
You can start with a combined
.framework
. Make two copies of the framework, and uselipo
to remove the slices from the binary that are associated with a different SDK.It is based on the original answer from Apple here.
My particular case is that I'm getting this error using Rome, which produces these frameworks (a possible solution is here). Also, a lot of struggling is going on on the Carthage side.