How to ignore some static library for iOS simulator

↘锁芯ラ 提交于 2019-12-09 19:11:58

问题


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.


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/11369589/how-to-ignore-some-static-library-for-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!