在 IOS 中提交我的第一个应用程序时更改 Xcode 中的包标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12545174/
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
Change bundle identifier in Xcode when submitting my first app in IOS
提问by ghostrider
I'm trying to submit my first app in iOS
. I have entered iOS Provisioning Portal
and I am about to create an app ID.
我正在尝试将我的第一个应用程序提交到iOS
. 我已经进入iOS Provisioning Portal
,我将要创建一个应用程序 ID。
Lets say that I name my bundle identifier:
假设我命名了我的包标识符:
com.mycompany.appdemo
Then going to Xcode and in the summary section I want to change the bundle identifier.
然后转到 Xcode,在摘要部分我想更改包标识符。
But I cannot erase what is being written there, only the start of it. The name of my app is in grey color and I cannot delete it or change it.
但我无法抹去写在那里的东西,只能抹去它的开始。我的应用程序名称为灰色,我无法删除或更改它。
So I see in grey color somethng like this App-Demo
which is the name of the project in the left side.
所以我看到像这样的灰色东西,这App-Demo
是左侧项目的名称。
My question is this:
Is it a problem? Do I have to create a new app id named com.mycompany.App-Demo
or something else?
我的问题是:这是一个问题吗?我是否必须创建一个名为com.mycompany.App-Demo
或其他名称的新应用程序 ID ?
Here is a picture also.
As you can see I can only edit the first part.
这里还有一张图片。
如您所见,我只能编辑第一部分。
回答by neilvillareal
By default, Xcode sets the bundle identifier to the bundle/company identifier that you set during project creation + project name.
默认情况下,Xcode 将包标识符设置为您在项目创建过程中设置的包/公司标识符 + 项目名称。
This is similar to what you see in the Project > Summary screen.
这类似于您在“项目”>“摘要”屏幕中看到的内容。
But you can change this in the Project > Info screen. (This is the Info.plist.)
但是您可以在“项目”>“信息”屏幕中更改此设置。(这是Info.plist的。)
回答by Marcin S.
I know that its late but it might be helpful for people who need to change the Bundle Identifier of the app. In the finder go to the project folder:
我知道它迟到了,但它可能对需要更改应用程序的捆绑标识符的人有所帮助。在 finder 中转到项目文件夹:
the project file --> Right click on your project file '*.xcodeproj'
--> choose 'Show Package Contents'
--> Double click to open 'project.pbxproj' file
--> find 'productName = NAME_YOU_WANT_TO_CHANGE' in the
'/* Begin PBXNativeTarget section */'
The ${PRODUCT_NAME:rfc1034identifier} variable will be replaced with the name you have entered and new Bundle Identifier will be updated to what you need it to be.
${PRODUCT_NAME:rfc1034identifier} 变量将替换为您输入的名称,并且新的捆绑标识符将更新为您需要的名称。
回答by Alexey Podlasov
Just change Product Namein your project's build settings. This will change the bundle identifier with no need to manually touch xcode configuration files.
只需在项目的构建设置中更改产品名称。这将更改包标识符,而无需手动接触 xcode 配置文件。
回答by Vinay Nishad
Just edit the Project name by single click on the Top of project navigator window, will work in this case. You need not to try any other thing. :)
只需通过单击顶部项目导航器窗口来编辑项目名称,就可以在这种情况下工作。您无需尝试任何其他事情。:)
回答by Scott Zhu
Here's the answer from Apple's official documentation, just tried, it's working.
这是Apple官方文档中的答案,刚刚尝试过,它正在工作。
Setting the Bundle ID
设置捆绑 ID
The default bundle ID in your Xcode project is a string formatted as a reverse-domain—for example, com.MyCompany.MyProductName. To create the default bundle ID, Xcode concatenates the company identifier with the product name you entered when creating the project from a template, as described in Setting Properties When Creating Your Xcode Project. (Xcode replaces spaces in the product name to create the default bundle ID.) It may be sufficient to replace the company identifier prefix in the bundle ID or you can replace the entire bundle ID. For example, change the company identifier prefix to match your company domain name or replace the entire bundle ID to match an explicit App ID.
Xcode 项目中的默认包 ID 是一个格式化为反向域的字符串,例如,com.MyCompany.MyProductName。要创建默认包 ID,Xcode 将公司标识符与您在从模板创建项目时输入的产品名称连接起来,如在创建您的 Xcode 项目时设置属性中所述。(Xcode 替换产品名称中的空格以创建默认包 ID。)替换包 ID 中的公司标识符前缀可能就足够了,或者您可以替换整个包 ID。例如,更改公司标识符前缀以匹配您的公司域名或替换整个包 ID 以匹配显式应用程序 ID。
For Mac apps, ensure that every bundle ID is unique within your app bundle. For example, if your app bundle includes a helper app, ensure that its bundle ID is different from your app's bundle ID.
对于 Mac 应用程序,请确保每个包 ID 在您的应用包中都是唯一的。例如,如果您的 app bundle 包含一个帮助应用程序,请确保其 bundle ID 与您的应用程序的 bundle ID 不同。
Follow these steps to change the bundle ID prefix in the General pane in the project editor.
按照以下步骤在项目编辑器的“常规”窗格中更改包 ID 前缀。
To set the bundle ID prefix
设置捆绑 ID 前缀
In the project navigator, select the project and your target to display the project editor.
Click General and, if necessary, click the disclosure triangle next to Identity to reveal the settings.
在项目导航器中,选择项目和目标以显示项目编辑器。
单击“常规”,如有必要,单击“标识”旁边的显示三角形以显示设置。
- Enter the bundle ID prefix in the “Bundle Identifier” field.
- 在“捆绑标识符”字段中输入捆绑 ID 前缀。
To set the bundle ID
设置捆绑 ID
In the project navigator, select the project and your target to display the project editor.
Click Info.
Enter the bundle ID in the Value column of the “Bundle identifier” row.
在项目导航器中,选择项目和目标以显示项目编辑器。
单击信息。
在“捆绑标识符”行的值列中输入捆绑 ID。
If you're feeling interested in reading more, please check APP Distribution Guidefrom Apple.
如果您有兴趣阅读更多内容,请查看Apple 的APP 分发指南。
回答by Suraj Sonawane
This solve my problem.
这解决了我的问题。
Just change the Bundle identifierfrom Build Setting.
只需从 Build Setting 中更改Bundle identifier 即可。
Navigate to Project >> Build Setting >> Product Bundle Identifier
回答by htafoya
Actually you can change it in Build Settings; at the bottom there is a section "User-Defined" where you can easily change PRODUCT_BUNDLE_IDENTIFIER.
实际上您可以在Build Settings 中更改它;在底部有一个“用户定义”部分,您可以在其中轻松更改PRODUCT_BUNDLE_IDENTIFIER。
I prefer this way, because if you change the info variable you are altering the reference to the other value.
我更喜欢这种方式,因为如果您更改 info 变量,您将更改对另一个值的引用。
回答by ruhanbidart
A very simple solution to that is to open the file:
一个非常简单的解决方案是打开文件:
YOURPROJECT.xcodeproj/project.pbxproj
And find for this variable:
而找到这个变量:
PRODUCT_BUNDLE_IDENTIFIER
You'll see something like that:
你会看到类似的东西:
PRODUCT_BUNDLE_IDENTIFIER = com.YOUR_APP_NAME.SOMETHING;
So, the name on the right is your Bundle Identifier. In my case it works perfectly.
因此,右侧的名称是您的捆绑标识符。在我的情况下,它完美地工作。
回答by kreker
Xcode 7
Xcode 7
Select root node of your project -> In editor click on project name -> Select targets -> Identity -> Bundle Identifier
选择项目的根节点 -> 在编辑器中单击项目名称 -> 选择目标 -> 身份 -> 捆绑标识符
回答by David Schumann
If you are developing a cordova app, make sure to change the version and bundle identifier in the config.xml
as well
如果你正在开发一个应用程序科尔多瓦,一定要更改版本和捆绑标识符中config.xml
,以及