61

Xcode 5 won't let me change the bundle identifier. The app name portion after com.mycompany. is greyed out.

I created a bundle identifier in ITC which slightly differs and I want to use this new bundle identifier.

Do I have to create a new Xcode project with the correct identifier?

openfrog
  • 40,201
  • 65
  • 225
  • 373
  • 1
    The quick way is to rename your project to match the desired name - this is because the name is derived from the PRODUCT_NAME variable. – Anya Shenanigans Oct 21 '13 at 18:15
  • 4
    You can manually change the build identifier in the info tab of the exectuable target - it is normally defined as `com.mycompany.${PRODUCT_NAME:rfc1034identifier}`, and you can change the `${PRODUCT_NAME:rfc1034identifier}` value to the desired bundle identifier – Anya Shenanigans Oct 21 '13 at 18:20
  • 5
    You can also change the Product Name variable in the Packaging section of the Build Settings, which changes the name – Anya Shenanigans Oct 21 '13 at 18:23
  • 3
    Petesh's comment: "You can also change the Product Name variable in the Packaging section of the Build Settings, which changes the name" Should be the answer! – Joseph DeCarlo May 16 '14 at 00:54

6 Answers6

68

Actually this is pretty simple:

  1. Select your target
  2. Select 'info' tab (you can do the same by finding the plist file on the project)
  3. Search for "Bundle Identifier" key, The value on your end should be com.mycompany.${PRODUCT_NAME:rfc1034identifier}.

If you want to change the grey field just replace the "com.mycompany" with whatever you want. the other field is the "Product Name" (which is read dynamically from the relevant key), You can change it by set the "Product Name" key on "Build Settings". You can also do it pretty ugly and change all the bundle identifier to whatever you want but I don't recommend that because if you would add more targets it would be static and harder to maintain.

Jeremy Wiebe
  • 3,894
  • 22
  • 31
Idan
  • 9,880
  • 10
  • 47
  • 76
57
  1. Select your target under the Targets section.
  2. Go to the Build Settings tab.
  3. Scroll down to Packaging.
  4. Change the Product Name to the desired one.

Pic

Tanner Semerad
  • 12,472
  • 12
  • 40
  • 49
Artyom
  • 851
  • 11
  • 15
  • 1
    This is the way one should follow to change the bundle identifier, because you stick to Xcode's conventions by not modifying or removing predefined constants. – yeyo Jul 30 '14 at 16:02
  • 2
    Good answer. Notice you will have to manually create a new app id if you're doing in app purchases. Probably bad to change the bundle id after submission. – SmileBot Aug 15 '14 at 15:55
18

In Xcode 5.1.1, you can do it by simply renaming your Target. Double-click on the Target name to change it.

sam
  • 3,399
  • 4
  • 36
  • 51
  • 1
    This answer is much cleaner than the above methods, let Xcode do all the work. – Derek Hewitt Sep 25 '14 at 06:58
  • Agreed. Bundle ID points to PRODUCT_NAME. PRODUCT_NAME points to TARGET_NAME. So changing the target name will propagate to the bundle ID. Until I read this I was expecting to see the target name as a property of the Target; wasn't thinking of clicking the target itself to change its name. – stone Jan 13 '15 at 08:31
14

In your projects Info.plist(or in Info tab of project setiings, which is the same) change ${PRODUCT_NAME:rfc1034identifier} to desired name. After that it wouldn't be greyed out.

Timur Kuchkarov
  • 1,155
  • 7
  • 21
  • This was actually the most precise and helpful answer for me, and for what I interpret to be the exact matter that the poster was likely to have been after... although of course there's always some guesswork on that. Literally it's "In -Info.plist edit Bundle Identifier by changing the portion, "${PRODUCT_NAME:rfc1034identifier}" to your preferred, literal text. This will give you control over the bundle text. In my case this was needed to match my team's convention for lowercase, while having uppercase in the displayed app name on the home screen. – Jack Bellis Sep 24 '15 at 13:32
0

I had to do this for my project too and found it easily done in Xcode 5.1.1 by just renaming the project name in the Navigator and allow Xcode to find all the strings you need to change automatically. Just make sure you check-in or create a snapshot of your project first.

ushika
  • 1,521
  • 1
  • 11
  • 4
0

Your bundle identifier is based on PRODUCT_NAME.

By default, PRODUCT_NAME is based on TARGET_NAME, which is quite difficult to change (XCode6 at time of writing). So don't be afraid to impose a different name here if necessary.

1owk3y
  • 1,115
  • 1
  • 15
  • 30