来自 {PRODUCT_NAME} 的 XCode 包标识符格式
假设我有一个 iPhone 应用程序,其产品名称在 XCode 构建设置中为“My App”(单词之间有空格)。在我的 info.plist 中,捆绑包标识符被指定为 com.mycompany.${PRODUCT_NAME:rfc1034identifier}
在生成的 info.plist 中应用程序包,包标识符显示为 com.mycompany.My-App。我需要它是com.mycompany.MyApp
。如何更改捆绑标识符设置,以便按照我想要的方式转换产品名称?
附: 如果我将 ${product_name:rfc1034identifier}
更改为 ${product_name:identifier}
,则生成的捆绑包标识符将为 com.mycompany.My_App
。我只需要在结果中完全删除产品名称中的空格字符即可。
Assume I have an iPhone application whose Product Name is "My App" (with a space between words) in XCode build settings. In my info.plist, the Bundle identifier is specified as com.mycompany.${PRODUCT_NAME:rfc1034identifier}
In the resulting info.plist in the application bundle, the bundle identifier is shown as com.mycompany.My-App
. I need it to be com.mycompany.MyApp
. How do I change the Bundle Identifier setting so it would convert the product name the way I want?
ps.
If I change the ${PRODUCT_NAME:rfc1034identifier}
to ${PRODUCT_NAME:identifier}
, the resulting bundle identifier will be com.mycompany.My_App
. I just need to remove the space character in the product name completely in the result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
直接输入就行了?
ie 而不是
com.mycompany.${PRODUCT_NAME:rfc1034identifier}
只需输入com.mycompany.MyApp
如果您有多个目标需要不同的捆绑包名称,一种方法是这样做就是创建您自己的变量并使用它。
在构建菜单中(选择您的项目并选择获取信息),您可以将自己的变量添加到项目中。如果您创建一个名为 MY_BUNDLE_NAME 并将其设置为 MyApp,则可以将
com.mycompany.${MY_BUNDLE_NAME}
放入 plist 文件中。您应该能够针对不同的目标将 MY_BUNDLE_NAME 设置为不同的值。Just type it in?
i.e. instead of
com.mycompany.${PRODUCT_NAME:rfc1034identifier}
just typecom.mycompany.MyApp
If you have more than one target that need different bundle names, one way of doing it is to create your own variable and use that instead.
In the build menu (select your project and choose Get Info), you can add your own variables to the project. If you make one called MY_BUNDLE_NAME and set it to MyApp, you can then put
com.mycompany.${MY_BUNDLE_NAME}
in the plist file. You should be able to set MY_BUNDLE_NAME to different values for different targets.xcode 和 itunnes 上应该有相同的包 ID:
在此文件中
$ touch Info.plist
捆绑包标识符(应用程序 ID 后缀)
输入您的应用程序 ID 的唯一标识符。建议的做法是对 App ID 的捆绑标识符部分使用反向域名样式字符串。
示例:com.domainname.appname
same bundle id should be on xcode and itunnes:
in this file
$ touch Info.plist
Bundle Identifier (App ID Suffix)
Enter a unique identifier for your App ID. The recommended practice is to use a reverse-domain name style string for the Bundle Identifier portion of the App ID.
Example: com.domainname.appname
接受的答案对我来说没有正确工作。它似乎改变了包标识符,但它弄乱了整个应用程序。就我而言,这个解决方案效果很好:
更改捆绑包标识符在 IOS 中提交我的第一个应用程序时的 Xcode
The accepted answer hasn't worked for me correctly. It seemed to change the bundle identifier however it messed up the whole app. In my case this solution worked fine:
Change bundle identifier in Xcode when submitting my first app in IOS