xcode 无法更改项目中的包 ID,显示为灰色

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

Can't change bundle ID in project, greyed out

iosxcodebundleidentifier

提问by Moo33

I'm having a problem with bundle identifiers. In the Summary section of my project in Xcode and under 'Identifiers', I can't seem to change the name of my bundle ID as it is greyed out. For example, my project name is 'My App'. In the identifier text box in Summary, it says this 'My-App' and is greyed out. However, my bundle id in my provisioning profile is this, 'com.mycompany.myapp'. I would like to change my bundle ID in my project to that but I can't seem to be able to. Any ideas why it is greyed out? Thanks!

我遇到了包标识符问题。在我的 Xcode 项目的“摘要”部分和“标识符”下,我似乎无法更改包 ID 的名称,因为它是灰色的。例如,我的项目名称是“我的应用程序”。在摘要中的标识符文本框中,它显示了“我的应用程序”并且显示为灰色。但是,我的配置文件中的包 ID 是“com.mycompany.myapp”。我想将项目中的捆绑 ID 更改为该 ID,但我似乎无法做到。任何想法为什么它变灰?谢谢!

回答by Alex Ross

If anybody else runs into this, it is likely because you have a product name variable, something like .${PRODUCT_NAME:rfc1034identifier}, appended to the end of your bundle identifier under Target (your application) > Info (info.plist). Try removing that.

如果其他人遇到这种情况,很可能是因为您有一个产品名称变量,例如 .${PRODUCT_NAME:rfc1034identifier},附加到 Target (your application) > Info (info.plist) 下的包标识符末尾。尝试删除它。

回答by ashokbabuy

Not sure why this is happening to you, but try to change in the info.plist file.

不确定为什么会发生这种情况,但尝试在 info.plist 文件中进行更改。

回答by Kunal Khanna

  1. Go to info.plistfile
  2. Go to Bundle Identifier key-value pair
  3. Remove .${PRODUCT_NAME:rfc1034identifier}from the value and save the file
  1. 转到info.plist文件
  2. 转到捆绑标识符键值对
  3. .${PRODUCT_NAME:rfc1034identifier}从值中删除并保存文件

Your bundle identifier has been modified as required.

您的捆绑标识符已根据需要进行了修改。

回答by Questor

You may want to consider changing the value of PRODUCT_NAME instead of directly changing the bundle identifier. This can be done thru the XCODE interface (and should have the added benefit of not possibly causing problems with certificates and code signing later on...which can be a real bear to resolve):

您可能需要考虑更改 PRODUCT_NAME 的值,而不是直接更改包标识符。这可以通过 XCODE 接口来完成(并且应该具有额外的好处,即不会在以后导致证书和代码签名问题......这可能是一个真正需要解决的问题):

Click here to see stackoverflow thread for detailed instructions on how to do this thru XCode interface

单击此处查看 stackoverflow 线程以获取有关如何通过 XCode 界面执行此操作的详细说明

回答by HaemEternal

If you want to edit the Product Name, rather than remove it; you can set it in your target, using the following steps:

如果您想编辑产品名称,而不是删除它;您可以使用以下步骤在目标中设置它:

  • Open the Target in XCode
  • Go to the Build Settings tab
  • Scroll down to Packaging->Product Name
  • 在 XCode 中打开目标
  • 转到构建设置选项卡
  • 向下滚动到包装-> 产品名称

The name set in Product Name is added to the Bundle Identifier (spaces are changed to dashes e.g "Test App" becomes "Test-App").

产品名称中设置的名称将添加到捆绑标识符中(空格更改为破折号,例如“Test App”变为“Test-App”)。

回答by Graham Perks

It may be that it's set in a .xcconfig file instead. For example, one Parse sample project has a 'debug.xcconfig' with:

它可能是在 .xcconfig 文件中设置的。例如,一个 Parse 示例项目有一个“debug.xcconfig”,其中包含:

BUNDLE_IDENTIFIER = com.parse.Anypic

If so, this is the place to change it.

如果是这样,这是改变它的地方。

回答by DonVaughn

I saw this also happen when the iOS Deployment Target is higher than your version of Xcode supports. Between World Wide Developers Christmas when they release the betas and when the new version is finalized.

当 iOS 部署目标高于您的 Xcode 支持版本时,我也看到了这种情况。在 World Wide Developers 圣诞节发布测试版和新版本最终确定之间。

So say you have a project with a min deployment for the current iOS beta version, but you are using the release version of Xcode. Just open the project in the current Xcode beta version.

因此,假设您有一个针对当前 iOS 测试版进行最小部署的项目,但您使用的是 Xcode 的发布版本。只需在当前 Xcode 测试版中打开项目即可。

回答by Mathieu Cote

This can also be related to user defined variables under [Target] > Build Settings > User-Defined

这也可能与 [Target] > Build Settings > User-Defined 下的用户定义变量有关