28

Assume I have an iPhone application whose Product Name is "My App" (with a space between words) in XCode build settings. In my info.plist, the Bundle identifier is specified as com.mycompany.${PRODUCT_NAME:rfc1034identifier}

In the resulting info.plist in the application bundle, the bundle identifier is shown as com.mycompany.My-App. I need it to be com.mycompany.MyApp. How do I change the Bundle Identifier setting so it would convert the product name the way I want?

ps. If I change the ${PRODUCT_NAME:rfc1034identifier} to ${PRODUCT_NAME:identifier}, the resulting bundle identifier will be com.mycompany.My_App. I just need to remove the space character in the product name completely in the result.

RedBlueThing
  • 42,006
  • 17
  • 96
  • 122
ravinsp
  • 4,150
  • 2
  • 32
  • 43

3 Answers3

43

Just type it in?

i.e. instead of com.mycompany.${PRODUCT_NAME:rfc1034identifier} just type com.mycompany.MyApp

If you have more than one target that need different bundle names, one way of doing it is to create your own variable and use that instead.

In the build menu (select your project and choose Get Info), you can add your own variables to the project. If you make one called MY_BUNDLE_NAME and set it to MyApp, you can then put com.mycompany.${MY_BUNDLE_NAME} in the plist file. You should be able to set MY_BUNDLE_NAME to different values for different targets.

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • 2
    Thanks for ur answer, but my situation is not as simple as that! Of course u have understood my question, but what I haven't told is that I have several "targets" of the same application that needs to have different bundle identifiers. So I need to configure the bundle identifier dynamically according to the build settings each of these targets have. for example, one target may have "My App1" as the product name and another target may have "My App2" as the product name. That's why I need to do this dynamically instead of hard coding. – ravinsp Feb 22 '10 at 09:25
  • 1
    Ah, that makes more sense! I've edited my answer; hope that's more helpful! – deanWombourne Feb 22 '10 at 12:03
  • Thanks dean! that would do it for me and I can see that these user-defined build settings will be useful for me in some other places as well. Thanks for the tip! – ravinsp Feb 23 '10 at 05:15
  • Extending that idea and depending on how many targets you've got, you could consider using schemes + build configurations and build scripts allowing you to have only a single target, everything configured dynamically. Just a tip :) – Rich Jan 12 '12 at 11:17
0

same bundle id should be on xcode and itunnes:

in this file $ touch Info.plist

Bundle Identifier (App ID Suffix) Enter a unique identifier for your App ID. The recommended practice is to use a reverse-domain name style string for the Bundle Identifier portion of the App ID.

Example: com.domainname.appname

0

The accepted answer hasn't worked for me correctly. It seemed to change the bundle identifier however it messed up the whole app. In my case this solution worked fine: Change bundle identifier in Xcode when submitting my first app in IOS

Community
  • 1
  • 1
Marcin S.
  • 11,161
  • 6
  • 50
  • 63