如何在Xcode中排除模拟器构建中的框架 [英] How to exclude frameworks in simulator builds in Xcode
问题描述
当我编译应用程序在模拟器上运行时,如何从Xcode项目中排除我只为iOS设备架构(libssh2等)编译的库?
How can I exclude libraries which I have compiled only for the iOS device architecture (libssh2, etc.) from an Xcode project when I am compiling the app to run on the simulator?
推荐答案
我知道这是一个老问题,但如果有人仍在寻找答案,可以使用弱链接来指定某些库可选。
I know this is an old question, but if someone's still looking for the answer, you can use Weak Linking to specify that certain libraries are optional.
然后,在通常使用特征的代码中,您可以检测到您在模拟器中在编译时与
Then, in the code that would normally use the features, you can detect that you're in the simulator at compile time with
#if TARGET_IPHONE_SIMULATOR
NSLog(@"I'm in the simulator");
#endif
或在运行时检查
or at run time by inspecting the value of
[[UIDevice currentDevice] model]
并以编程方式避免使用模拟器环境中不存在的库。
and programmatically avoid using the libraries that don't exist in the simulator environment.
这篇关于如何在Xcode中排除模拟器构建中的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!