iPhone / Xcode:不同的项目目标可以有不同的包标识符吗? [英] iPhone/Xcode: can different project targets have different bundle identifiers?

查看:171
本文介绍了iPhone / Xcode:不同的项目目标可以有不同的包标识符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑这是如何工作的 - 这是我的理解:

I'm a little confused how this works - this is my understanding:


  • 目标的配置文件链接到特定的应用程序ID

  • 目标的包标识符位于目标信息\ Properies \Identifier

  • A target's provisioning profile is linked to a specific app ID
  • The bundle identifier for a target is found under Target info\Properies\Identifier

但是...包ID也位于Info.plist中。如果您更改 Info.plist 中的捆绑包ID,Xcode会在目标信息\Properties \Identifier 中自动更改它,反之亦然。

But... bundle ID is also located in Info.plist. It seems that if you change the bundle ID in Info.plist, Xcode changes it automatically in Target info\Properties\Identifier, and vice versa.

那么哪个优先? 目标信息\属性\Identifier 捆绑包ID或 Info.plist 捆绑包ID?

So which is it that takes precedence? The Target info\Properties\Identifier bundle ID or the Info.plist bundle ID?

原因我问的是因为我想为我的应用程序提供两个版本 - 免费广告支持版本和付费版本,我想用两个不同的目标实现这一目标。由于他们将是App Store中的两个不同的应用程序,我的理解是他们需要两个不同的应用程序ID(我不想沿着带有应用程序ID的*路线,在App Store上如何工作的描述使我的脑伤害。

The reason I ask is because I'd like to have two versions for my app - a free ad supported version and a paid version, and I'd like to accomplish that with two different targets. Since they will be two different apps in the App Store, my understanding is they need two different app IDs (and I don't want to go down the * route with app IDs, the description of how that works on the App Store made my brain hurt).

如果我这样做,我是否需要为每个目标使用两个不同的Info.plists,或者我可以使用相同的Info.plist,只是有不同的目标使用不同的开发/分配配置文件?

Would I need two different Info.plists for each target if I did this, or can I use the same Info.plist, and just have the different targets use a different development/distribution provisioning profile?

推荐答案

没有优先权,属性对话框仅用作另一个你可以看到你的Info.plist。

There isn't a precedence, the properties dialog is just serving as another way for you to see your Info.plist.

要在目标之间共享plist但有不同的标识符,请确保在Info.plist文件中展开构建设置 为两个目标启用了选项。然后,对于每个目标,在包ID的目标设置中创建一个新的用户创建的变量(例如,APPLICATION_BUNDLE_IDENTIFIER,请参见此处: https ://stackoverflow.com/a/18472235/308315 )并将其设置为该目标的正确值。在您的plist中,为包ID添加以下内容:

To share the plist between the targets but have different identifiers, make sure that the "Expand Build Settings in Info.plist File" option is enabled for both targets. Then, for each target, make a new user-created variable in the target settings for your bundle ID (e.g., APPLICATION_BUNDLE_IDENTIFIER, see here: https://stackoverflow.com/a/18472235/308315) and set it to the right value for that target. In your plist, put the following for bundle ID:

<key>CFBundleIdentifier</key>
<string>$(APPLICATION_BUNDLE_IDENTIFIER)</string>

变量将在构建时针对每个目标进行评估,因此每个目标都将获得正确的捆绑ID。

The variable will be evaluated at build time for each target, so each will get the right bundle ID.

这篇关于iPhone / Xcode:不同的项目目标可以有不同的包标识符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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