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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14740538/
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-08-30 22:10:37  来源:igfitidea点击:

Xcode - change bundle identifier but not product name

iosxcode

提问by soleil

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. However, this also causes the app to be called "myappname" on the device home screen (under the icon). I know that has to able to be set differently. (I want "My App" to be displayed instead of "myappname"). Where do I set this?

似乎在 Xcode 中执行此操作的唯一方法是转到目标、构建设置,并将产品名称更改为 myappname。但是,这也会导致应用在设备主屏幕上(在图标下)被称为“myappname”。我知道必须能够以不同的方式设置。(我希望显示“我的应用程序”而不是“我的应用程序名称”)。我在哪里设置这个?

回答by James Bedford

You set this as the "Product Name" in the Build Settings in Xcode. You want to set your bundle identifier in the info.plist file for your app.

您在 Xcode 的构建设置中将其设置为“产品名称”。你想在 info.plist 文件中为你的应用设置你的包标识符。

The bundle identifier in the Info.plist can contain placeholder variables such as ${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.

Info.plist 中的包标识符可以包含占位符变量,例如 ${PRODUCT_NAME}。编译应用程序时,这些占位符变量将替换为来自构建设置的值。使用 plutil 查看 .app 包中 Info.plist 的编译版本。

回答by spencery2

The "Bundle identifier" and "Bundle display name" are set in the info.plist file. 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. 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.

“Bundle identifier”和“Bundle display name”在 info.plist 文件中设置。“捆绑显示名称”是主屏幕上的应用程序图标显示的内容。它们可以使用占位符值,例如 ${PRODUCT_NAME} 或 ${PRODUCT_NAME:rfc1034identifier},或者您可以明确设置它们。“产品名称”在构建设置中设置。您可以首先按照您想要的方式设置“产品名称”,然后通过编辑 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”,将捆绑标识符保留为“com.mydomain.${PRODUCT_NAME:rfc1034identifier}”,然后将捆绑显示名称设置为“我的应用” ”。

回答by teapeng

What I did is put in the matching bundle identifier name at "Build Settings > Product Name". And then key in the actual App Name at the "Info > Bundle Display Name". Overwrite the ${PRODUCT_NAME} variable and key in the exact "My App". This do the trick.

我所做的是在“构建设置 > 产品名称”中放入匹配的包标识符名称。然后在“信息 > 捆绑显示名称”中输入实际的应用程序名称。覆盖 ${PRODUCT_NAME} 变量并键入确切的“我的应用”。这行得通。