iOS9: Using dynamic framework with Simulator and Device iOS9: Using dynamic framework with Simulator and Device swift swift

iOS9: Using dynamic framework with Simulator and Device


What you are looking to do is build a "Universal Framework". I answered a question about this here, but I will summarize the main points for you:

The reason you aren't able to compile it because the simulator runs on a different architecture than a device. Also, different iPhone models run on different architectures. You can look at this image to see what devices run on each architecture. The simulator runs on the mac arcs, which are i386 and x86. What you need to do is build for each architecture, then merge them all together through a process called "lipo".

To do this you want to set "Build Active Architectures" to NO. Then you should build your framework for a "Generic iOS Device". Then if you copy the build script from my first link, and put it as an aggregate target, this will build out each architecture and merge them into what will be your final product. This is called a FAT framework, and you can then run the command "lipo -info" in the terminal and you will see that your framework contains all architectures, which is what you want.