I have created one project (Project 1) in which I am creating one framework which I want to use in different project (project 2) just like any other framework (drag drop in project).
My Issue
But when I created framework (in project 1) keeping device selected in xcode when I use this framework in my project 2 it works only for device not for simulator. vice versa if I created framework in project 1 keeping simulator selected in xcode and use this framework in project 2 it only works for simulator the.
errors for this is
What I am trying to achieve
My framework created from project 1 should run on both device and simulator in project 2.
following are my settings in both the projects
Xcode will build the framework according to the target selected. If framework built for simulator, architecture will be X86_64,i386, on the other hand for device it will be armv7, arm64. Can check the architecture of the framework using lipo command as below.
lipo -info sample.frameowrk/sample
Now , in your case you want your framework should support both simulator and device. So, you need to combine both framework (built for device and simulator) and create a FAT framework using lipo command as below:
lipo <path to framework build for simulator>/simulator.framework <path to framework build for device>/device.framework -create -output universal.framework
Resulted universal framework will support both platform. You can check the architecture supported by the universal framework as below:
lipo -info universal.framework/universal
output : arm64,armv7,x86_64,i386
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.