Reputation: 2583
I am trying to build my project for sdk iphoneos and iphonesimulator. There are few .a static libraries that can only be utilized for iphoneos. Where can I go an ignore these files if its being build for iphonesimulator within XCode?
Thanks.
Upvotes: 4
Views: 2878
Reputation: 405
Instead of hard linking the libraries, use the "Other Linker Flags" setting in the project configuration settings. You'll be able to link different versions of libraries based on the current build configuration.
By default you already have Debug and Release build configuration, press the "plus" button on the Debug will add a configuration for a specific architecture. Choose "Any iOS Simulator" and link the libraries you would like to use to run the app on simulator. Then press the "plus" button on the Debug again, this time choose "Any iOS" and link the libraries you would like to use to run the app on the device.
Lastly, do the same thing for the Release configuration.
Upvotes: 8
Reputation: 18225
I just had this issue and I solved by creating a new target just for the simulator.
At the new target you can go to the target settings -> build phases -> link binary with libraries and removed the static library just for that target.
Also make sure you do not include the files from the static library by using the TARGET_IPHONE_SIMULATOR
macro for checking, just as @MDT did.
Upvotes: 0
Reputation: 4950
You can set two targets, one for simulator and one for device, and in the simulator target settings (Build Phases -> Link Binary With Libraries) remove the unwanted *.a files
Upvotes: 2