How to ignore some static library for iOS simulator

寵の児 提交于 2019-12-04 12:13:37

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.

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

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.

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