I\'m trying to make a dynamic framework for an iOS app. Thanks to the new version of Xcode (6) we can select a Cocoa Touch Framework when we create a new project and there i
This question was posted awhile ago(Xcode 6) but I encountered the same problem recently with Xcode 10.
So the problem is: the built framework doesn't support enough architectures.
In case one doesn't know what architectures stand for, different iPhone devices have different architectures, here's a complete list:
So, if you are using the framework on simulator, the framework needs to support either i386 or x86_64; if you are running your app on iPhone 6, the framework needs to support arm64 architecture.
Therefore, in most cases, a framework needs to support all the aforementioned architectures.
Now back to how to solve the problem. We need to build the framework for both devices and simulators.
How to build for devices:
How to build for simulators:
How to build for both devices and simulators:
After you have the framework for devices, you will need to combine the framework for simulators and the framework for devices together with "lipo" command. Rename the framework for simulators to [MyFrameworkProject]_sim.framework and copy both frameworks to the same folder. Run command below in Terminal(make sure you are in the folder):
lipo -create -output [MyFrameworkProject].framework/[MyFrameworkProject] [MyFrameworkProject].framework/MyFrameworkProject [MyFrameworkProject]_sim.framework/MyFrameworkProject
Now [MyFrameworkProject].framework is the final product that supports both simulators and devices.