如何在为设备而不是 iOS 模拟器构建时只包含一个框架?

2023-05-17移动开发问题
1

本文介绍了如何在为设备而不是 iOS 模拟器构建时只包含一个框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我们使用的第三方推送通知框架尚未针对 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.

可以实现吗?

推荐答案

  1. Build Phases > Link Binary With Libraries
  2. 中让你的框架可选不是必需
  3. Build Settings > Linking 中的Other Linker Flags"中为选项 Any iOS Simulator SDK 创建调试标志并添加值 -ObjC -weak_framework YourFrameworkName.
  4. 并在代码中检查像这样的构建目标 #if TARGET_IPHONE_SIMULATOR.
  1. Make your framework optional not required in Build Phases > Link Binary With Libraries
  2. In Build Settings > Linking in "Other Linker Flags" create Debug flag for option Any iOS Simulator SDK and add value -ObjC -weak_framework YourFrameworkName.
  3. And in code check for build target like this #if TARGET_IPHONE_SIMULATOR.

这篇关于如何在为设备而不是 iOS 模拟器构建时只包含一个框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

[ios.cocos2d+box2d]如何禁用自动旋转?
[ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)...
2024-08-12 移动开发问题
7

从 Documents 目录存储和读取文件 iOS 5
Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)...
2024-08-12 移动开发问题
9

如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?
How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?(如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?)...
2024-08-12 移动开发问题
13