我可以强制要求设备或模拟器始终用于构建特定目标吗?
我有一个包含两个不同目标的静态库:一个为设备构建,一个为模拟器构建。最后,我有一个使用 lipo 将两个目标结合起来的目标。
目前,我必须手动构建每个目标,并指定应为模拟器构建模拟器目标,并应为设备构建设备目标。
如果我使用这些目标之一作为构建依赖项,则它们都将为设备或模拟器构建。有没有一种方法可以强制每个目标始终分别为设备/模拟器构建?
I have a static library with two different targets: one to build for the device, one to build for the simulator. Finally, I have a target that combines the two targets using lipo.
Currently, I have to build each target manually and specify that the the simulator target should be built for the Simulator, and the device target should be built for the Device.
If I use one of these targets as a build dependency, they will either both be built for the device or for the simulator. Is there a way that I can force each target to always build for the device/simulator respectively?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可以通过使用命令行 xcodebuild 实用程序轻松完成:
然后,对于您的 lipo 目标,您可以添加一个脚本构建阶段,在该阶段中您可以在将这两个命令与 lipo 组合之前运行这两个命令。
如果您的前两个目标只是为了使用正确的 SDK 构建而分开,现在您可以删除其中一个并通过仅设置不同的 SDK 来运行相同的构建命令两次。您还应该考虑在 Makefile 中运行 lipo,在这种情况下您也不需要 lipo 目标。
问候
This can be easily done by using the command line xcodebuild utility:
Then for your lipo target you can add a script build phase in which you can run the two commands before combining them with lipo.
If your first two targets are separated just for the sake of building with correct SDK now you can remove one of them and run the same build command twice by setting only a different SDK. You should also consider running lipo within a Makefile in which case you would not need the lipo target as well.
regards
您可以通过在代码中添加某些条件来限制构建。但一旦您在设备中安装应用程序,它们就会起作用。
您可以在“application didFinishLaunch”方法中添加如下一些条件。
问候,
萨蒂亚
You can restrict the build by putting certain conditions in the code. But they will work once you install the App in the device.
You can put some conditions like the following in the "application didFinishLaunch" method.
Regards,
Satya