在 IOS 中提交我的第一个应用时更改 Xcode 的 bundle 标识符

我试图提交我的第一个应用程序在 iOS。我已经输入了 iOS Provisioning Portal,我正要创建一个应用程序 ID。

假设我将我的 bundle 标识符命名为:

com.mycompany.appdemo

然后转到 Xcode,在摘要部分,我想更改 bundle 标识符。

但是我不能抹去写在那里的东西,只是它的开始。我的应用程序的名称是灰色的,我不能删除或更改它。

因此,我看到在灰色的颜色像这样的 App-Demo,这是在左侧的项目名称。

我的问题是: 这是一个问题吗? 我必须创建一个新的应用程序 ID 名为 com.mycompany.App-Demo或其他东西?

这里还有一张图片。 enter image description here 如你所见,我只能编辑第一部分。

202134 次浏览

By default, Xcode sets the bundle identifier to the bundle/company identifier that you set during project creation + project name.

Project Creation - Bundle/Company Identifier + Product Name

This is similar to what you see in the Project > Summary screen.

Project > Summary

But you can change this in the Project > Info screen. (This is the Info.plist.)

Project > Info

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:

the project file --> Right click on your project file '*.xcodeproj'

enter image description here

--> choose 'Show Package Contents'
--> Double click to open 'project.pbxproj' file

enter image description here

--> 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.

Just change Product Name in your project's build settings. This will change the bundle identifier with no need to manually touch xcode configuration files.

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. :)

Here's the answer from Apple's official documentation, just tried, it's working.

Setting the Bundle 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.

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.

Follow these steps to change the bundle ID prefix in the General pane in the project editor.

To set the bundle ID prefix

  1. In the project navigator, select the project and your target to display the project editor.

  2. Click General and, if necessary, click the disclosure triangle next to Identity to reveal the settings.

enter image description here

  1. Enter the bundle ID prefix in the “Bundle Identifier” field.

To set the bundle ID

  1. In the project navigator, select the project and your target to display the project editor.

  2. Click Info.

  3. Enter the bundle ID in the Value column of the “Bundle identifier” row.

enter image description here

If you're feeling interested in reading more, please check APP Distribution Guide from Apple.

In XCode 7 you can update your bundle identifier by double clicking your target and changing the name. enter image description here

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.

I prefer this way, because if you change the info variable you are altering the reference to the other value.

enter image description here

This solve my problem.

Just change the Bundle identifier from Build Setting.

 Navigate to Project >> Build Setting >> Product Bundle Identifier

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.

Xcode 7

Select root node of your project -> In editor click on project name -> Select targets -> Identity -> Bundle Identifier

If you are developing a cordova app, make sure to change the version and bundle identifier in the config.xml as well

View this picture to see how you can change the bundle identifier

Explanation:

  1. Select your project form the leftmost project navigator
  2. Under the General Tab, there is a section called Targets inside where you will see the name of your project. Click on the name.
  3. Then you will be able to see the bundle identifier which you can change as below:

As you can see in the picture, the name of my App is PracticeApp. And my bundle identifier is: com.hello500.PracticeApp

In this case, You can change hello500 to change the bundle identifier of the app.