CFBundleIdentifier ... contains illegal character ' '

Discussion in 'iOS Programming' started by BlackMax, Mar 22, 2009.

  1. BlackMax macrumors 6502a


    Jan 14, 2007
    North Carolina

    I'm new to Xcode and iPhone programming, so pardon the question if it is a really simply fix. I keep getting the following build error and have not been able to determine the root cause. It only happens when I'm building to my iPhone and not when I build to the iPhone simulator. I've successfully built another small App to my iPhone, so I *believe* my development certificate and provisioning profile are OK.

    Has anyone seen the following error before:

    Building target “Button Fun” of project “Button Fun” with configuration “Debug”
    ProcessingProductPackaging /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/Entitlements.plist "/Users/jcridge/My_Projects/Button Fun/build/Button Fun.xcent"
    <>: error: CFBundleIdentifier 'com.yourcompany.Button Fun' contains illegal character ' ' 
    I see references to the file "Entitlements.plist", but I've looked and cannot find this file associated with my project.

    Any and all assistance is greatly appreciated.

  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    CFBundleIdentifier cannot contain a space like 'com.yourcompany.Button Fun' does.
  3. BlackMax thread starter macrumors 6502a


    Jan 14, 2007
    North Carolina
    Thanks dejo for the explanation. That makes sense and I did see that space there, but everywhere I looked in Xcode for this project I saw that Xcode placed an underscore in the name such as "button_fun".

    Now I'm trying to figure out where to correctly replace this space with an underscore. Is the "CFBundleIdentifier" variable the same thing as the "Bundle intentifier" field in my "Button_Fun-Info.plist" file?

    This field contains the following entry:

    So it appears the ${PRODUCT_NAME} variable fills in the application name here?

    What is the best way to remove the space in the "CFBundleIdentifier" variable?

    Thanks again for you assistance.
  4. zakkhoyt macrumors newbie

    Mar 6, 2009
    Very strange......

    I have my App ID set up as nnnnnnnnnn.*, where n is an integer.

    Used to be I could just enter '*' for the identifier in the target and/or plist (target is looked at before plist for validation FYI. I just found that out and found it useful).

    Now I have upgraded to os/sdk 3.0b3 / xcode 3.1.3. It seems that now, '*' is not allowed, so I tried ${PRODUCT_NAME}. However, the product name contains an '_', which is also an illegal char..... pffffftttt! I just ended up entering my firstlast name..... it works, but doesn't really make sense.

    I don't know why there are so many illegal chars now, but it's working for me now. I hope this information helps someone :)
  5. Niiro13 macrumors 68000

    Feb 12, 2008
    You can simply replace the ${PRODUCT_NAME:rfc1034identifier} with ButtonFun. or whatever.
  6. man2manno macrumors member

    Mar 21, 2009
    Question too

    I have a similar question.
    I submitted an app to the App Store about a month ago and the Bundle Identifier was something like:
    I am trying to update that same app, and I made the bundle Identifier the same thing however I am getting that "The bundle identifier contains disallowed characters" error. But when I make it the .com.yourcompany.yourappname I get an error saying something like "The Applications bundle identifier needs to be the same as the minor verison"

    Any thoughts? Thanks

Share This Page