如何在 Xcode 中针对不同配置填充不同的 Info.plist

发布于 2024-10-08 01:58:23 字数 304 浏览 0 评论 0原文

我需要为 iOS 设备填充不同的 Info.plists同一目标的模拟器方案。我该如何实现它? 问题如下:我的应用程序是 voip,因此我需要将 UIBackgroundModes 添加到 Info.plist,但问题是,当 plist 中存在此属性并且我运行模拟器方案时,模拟器只是卡在启动屏幕上,我即使按主页按钮也不会执行任何操作,控制台也不会显示任何内容。所以我想要一个用于模拟器方案的 plist,不带 UIBackgroundModes 属性,而第二个 - 带。我可以使用 shell 脚本来完成此操作,但由于这两种方案的脚本相同,我不知道如何区分它们...

TIA

I need to populate different Info.plists for iOS Device & Simulator schemes for the same target. How do I achieve it?
The problem is as following: My application is voip therefore I need to add a UIBackgroundModes to Info.plist, but the problem is that when this property exists in the plist and I run the Simulator scheme, Simulator just stuck on the splash screen and I even pressing Home button doesn't do anything, Console doesn't show anything either. So I'd like to have one plist for Simulator scheme w/o UIBackgroundModes property and the second - with. I could do it with a shell script, but since the script is same for both schemes I don't know how to distinguish between them...

TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾城°AllureLove 2024-10-15 01:58:23

另一个解决方案:

在 Xcode 4.3(可能更早)中,您可以在 Info.plist 中使用预处理器定义。因此,您可以将 UIBackgroundModes 设置为 ${MY_BACKGROUNDMODES}

在构建设置中,您可以为每个构建配置定义不同的 MY_BACKGROUNDMODES 值。

Another solution:

In Xcode 4.3 (and possibly earlier) you can use preprocessor defines in your Info.plist. So you can for example set your UIBackgroundModes to ${MY_BACKGROUNDMODES}

In your build settings you can then define different MY_BACKGROUNDMODES values per build configuration.

硪扪都還晓 2024-10-15 01:58:23

在项目视图中。如果您单击任何给定的组文件夹,则会在其内容拆分的上半部分中显示一个表格列表。

最右边的列是一个复选框,告诉您该项目是否包含在目标中。克隆出您的调试目标配置和 plist。在模拟配置中包含一个 plist,在设备配置中包含另一个。

In the project view. If you click on the any given group folder a table listing appears in the top half of the split of its contents.

The rightmost column is a tick box which tells you whether the item is included in the target. Clone out your debug target config and the plist. Include one plist in your simulation config and the other in your device config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文