如何在Xcode中排除模拟器构建中的框架 [英] How to exclude frameworks in simulator builds in Xcode

查看:189
本文介绍了如何在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.

请参阅此答案,在XCode 4中定义弱/可选链接

然后,在通常使用特征的代码中,您可以检测到您在模拟器中在编译时与

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆