How to only include a framework when building for device, not iOS Simulator?(如何在为设备而不是 iOS 模拟器构建时只包含一个框架?)
本文介绍了如何在为设备而不是 iOS 模拟器构建时只包含一个框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们使用的第三方推送通知框架尚未针对 x86_64 进行编译,这意味着每当我们为模拟器构建时,都会收到构建警告.由于我们试图将警告视为错误,因此这是行不通的.
We’re using a third-party push notification framework which has not been compiled for x86_64, which means that whenever we build for the simulator, we get a build warning. Since we’re trying to treat warnings as errors, this won’t do.
我只想在设备上构建时包含这个框架.然后我只会编译在设备上使用它的代码.
I’d like to only include this framework when building on devices. I’ll then only compile the code that uses it on devices too.
可以实现吗?
推荐答案
- 在Build Phases > Link Binary With Libraries 中让你的框架
- 在 Build Settings > Linking 中的Other Linker Flags"中为选项 Any iOS Simulator SDK 创建调试标志并添加值
-ObjC -weak_framework YourFrameworkName代码>.
- 并在代码中检查像这样的构建目标
#if TARGET_IPHONE_SIMULATOR
.
可选
不是必需
- Make your framework
optional
notrequired
in Build Phases > Link Binary With Libraries - In Build Settings > Linking in "Other Linker Flags" create Debug flag for option Any iOS Simulator SDK and add value
-ObjC -weak_framework YourFrameworkName
. - And in code check for build target like this
#if TARGET_IPHONE_SIMULATOR
.
这篇关于如何在为设备而不是 iOS 模拟器构建时只包含一个框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:如何在为设备而不是 iOS 模拟器构建时只包含一个框架?


基础教程推荐
猜你喜欢
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01