xcode 是否应该从 plist 文件中的 CFBundleIdentifier 中删除 rfc1034identifier?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2468176/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:12:15  来源:igfitidea点击:

Should the rfc1034identifier be removed from the CFBundleIdentifier in plist file?

iosxcodeapp-storeapp-idrfc1034identifier

提问by bobo

In my Xcode project's plist file, I can see the value for the key CFBundleIdentifieris:

在我的 Xcode 项目的 plist 文件中,我可以看到键的值CFBundleIdentifier是:

com.mycompany.${PRODUCT_NAME:rfc1034identifier}

com.mycompany.${PRODUCT_NAME:rfc1034identifier}

Obviously I will have to change com.mycompany to the domain name of my company, but I have no idea whether the rfc1034identifiershould be removed so that it becomes:

显然,我必须将 com.mycompany 更改为我公司的域名,但我不知道是否rfc1034identifier应该将其删除,使其变为:

com.mycompany.${PRODUCT_NAME}

com.mycompany.${PRODUCT_NAME}

Google did not help answering my question. Does this rfc1034identifieraffect the AppID that I should provide in the iPhone Developer program - Provisioning Portal?

谷歌没有帮助回答我的问题。这是否rfc1034identifier会影响我应该在 iPhone 开发人员计划 - 供应门户中提供的 AppID?

回答by deanWombourne

The :rfc1034identifier just formats it (if needed) so there are no illegal characters* in the bundle name. You're unlikely to have a product that is called by an illegal character but it's not impossible.

:rfc1034identifier 只是对其进行格式化(如果需要),因此包名称中没有非法字符*。您不太可能拥有被非法角色调用的产品,但这并非不可能。

I'd leave it in there but it's really up to you.

我会把它留在那里,但这真的取决于你。

(Actually, most of the time I just hardcode the bundle - that way if the product name changes for any reason, it's still got the same bundle identifier when I come to update it in the app store)

(实际上,大多数时候我只是对包进行硬编码 - 这样,如果产品名称因任何原因更改,当我在应用商店中更新它时,它仍然具有相同的包标识符)

*such as a space or a dot - they will be replaced with a dash so 'My Game' would become 'My-Game'

*例如空格或点 - 它们将被替换为破折号,因此“我的游戏”将成为“我的游戏”

回答by Jim Soper

My understanding (though trial and error) is that the identifier must be unique for each app that you submit, or load onto an iOS device via iTunes or directly. So even if your used a '*' as the identifier (1), each app must have it's own unique identifier. So, unless you change the PRODUCT_NAME from app to app, you want to append something after ${PRODUCT_NAME:rfc1034identifier}, to make sure it's unique. I add a date in YYMMDD format to do this : ${PRODUCT_NAME:rfc1034identifier}110524 (for May 24, 2011)

我的理解(尽管反复试验)是,对于您提交或通过 iTunes 或直接加载到 iOS 设备上的每个应用程序,标识符必须是唯一的。因此,即使您使用“*”作为标识符 (1),每个应用程序也必须有自己的唯一标识符。因此,除非您将 PRODUCT_NAME 从应用程序更改为应用程序,否则您希望在 ${PRODUCT_NAME:rfc1034identifier} 之后附加一些内容,以确保它是唯一的。我添加了 YYMMDD 格式的日期来执行此操作:${PRODUCT_NAME:rfc1034identifier}110524(2011 年 5 月 24 日)

(1) ie: in the provisioning portal, when you create a a new app id, you put a '*' in the 'Bundle Identifier (App ID Suffix)" field

(1) 即:在配置门户中,当您创建新的应用程序 ID 时,您在“捆绑标识符(应用程序 ID 后缀)”字段中放置一个“*”