简体   繁体   English

Xcode - 更改包标识符,但不更改产品名称

[英]Xcode - change bundle identifier but not product name

My bundle identifier has to match the one in the iOS dev portal: 我的包标识符必须与iOS开发门户网站中的标识符匹配:

com.mydomain.myappname com.mydomain.myappname

It seems the only way to do this in Xcode is to go to Targets, Build Settings, and change the Product Name to myappname. 似乎在Xcode中执行此操作的唯一方法是转到目标,构建设置,并将产品名称更改为myappname。 However, this also causes the app to be called "myappname" on the device home screen (under the icon). 但是,这也会导致应用程序在设备主屏幕上显示为“myappname”(在图标下方)。 I know that has to able to be set differently. 我知道必须能够以不同的方式设置。 (I want "My App" to be displayed instead of "myappname"). (我希望显示“我的应用程序”而不是“myappname”)。 Where do I set this? 我在哪里设置这个?

You set this as the "Product Name" in the Build Settings in Xcode. 您在Xcode的Build Settings中将其设置为“Product Name”。 You want to set your bundle identifier in the info.plist file for your app. 您想在应用的info.plist文件中设置包标识符。

The bundle identifier in the Info.plist can contain placeholder variables such as ${PRODUCT_NAME}. Info.plist中的捆绑包标识符可以包含占位符变量,例如$ {PRODUCT_NAME}。 These placeholder variables are replaced with their values from the build settings when the app is compiled. 编译应用程序时,这些占位符变量将替换为构建设置中的值。 Use plutil to see the compiled version of the Info.plist in your .app bundle. 使用plutil查看.app包中Info.plist的编译版本。

The "Bundle identifier" and "Bundle display name" are set in the info.plist file. “Bundle identifier”和“Bundle display name”在info.plist文件中设置。 The "Bundle display name" is what shows up by the app icon on the Home screen. “捆绑显示名称”是主屏幕上的应用程序图标显示的内容。 They can use placeholder values such as ${PRODUCT_NAME} or ${PRODUCT_NAME:rfc1034identifier}, or you can set them explicitly. 他们可以使用占位符值,例如$ {PRODUCT_NAME}或$ {PRODUCT_NAME:rfc1034identifier},也可以明确设置它们。 The "Product Name" is set in the Build Settings. “产品名称”在“构建设置”中设置。 You can first set the "Product Name" the way you want it, and then adjust or override the derived values by editing the info.plist file. 您可以先按照您希望的方式设置“产品名称”,然后通过编辑info.plist文件来调整或覆盖派生值。

It sounds like what you want to do is set the Product Name to be "myappname", leave the Bundle identifier to be "com.mydomain.${PRODUCT_NAME:rfc1034identifier}", and then set the Bundle display name to be "My App". 听起来你想要做的就是将产品名称设置为“myappname”,将Bundle标识符保留为“com.mydomain。$ {PRODUCT_NAME:rfc1034identifier}”,然后将Bundle显示名称设置为“My App” ”。

What I did is put in the matching bundle identifier name at "Build Settings > Product Name". 我所做的是在“Build Settings> Product Name”中输入匹配的包标识符名称。 And then key in the actual App Name at the "Info > Bundle Display Name". 然后在“Info> Bundle Display Name”中键入实际App Name。 Overwrite the ${PRODUCT_NAME} variable and key in the exact "My App". 覆盖$ {PRODUCT_NAME}变量并输入确切的“我的应用”。 This do the trick. 这样就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM