Bundle Identifier Illegal Characters Behavior in iPhone SDK 3.1.2

October 16, 2009 Comments Off

With iPhone SDK 3.1.2 and the associated XCode (3.2.1 Snow Leopard, 3.1.4 Leopard), Apple made a change in which illegal characters in the Bundle Identifier cause a build error like:

<com.apple.tools.product-pkg-utility>: error: CFBundleIdentifier ‘com.qdideas.awesome_app’ contains illegal character ‘_’

A Bundle Seed ID (a 10 character string generated by Apple, like ABCDE12345) followed by a Bundle Identifier that you provide (like com.qdideas.awesome-app) make an Application ID (ABCDE12345.com.qdideas.awesome-app). Each of your applications will have the same Bundle Seed ID and a different Bundle Identifier. The Application ID uniquely identifies an application and, once approved for sale, cannot be changed. Updates for an existing application must have the same Application ID as the original app.

Apple’s recommendation for the Bundle Identifier is a reverse domain name (com.qdideas instead of qdideas.com). The Bundle Identifier is restricted in character set the same way that domain names are, to the Uniform Type Identifiers (UTI) character set. The only valid characters are upper and lower letters (A-Z, a-z), digits (0-9), a period (.) and a hyphen (-). Some logical but illegal characters are underscore (_), space, and colon (:). These characters have always been illegal, but with previous versions of XCode use of these illegal characters would not cause a build error. The latest version of XCode (associated with iPhone OS 3.1.2) will generate a build error pointing to this cause.

If you get an error that your CFBundleIdentifier contains an illegal character, it is only necessary to change the Identifier field in the Properties tab of the target’s info window, removing or replacing the illegal character. It is possible to use a variable to automate the value of the Bundle Identifier, like com.qdideas.${PRODUCT_NAME}. This will cause a problem if your Product Name build setting (which was set by default as the project name when it was created) contains a space or other illegal character. To fix this, simply replace @{PRODUCT_NAME} with a legal string like “awesome-app” (making the whole Identifier “com.qdideas.awesome-app”).

From Apple’s documentation:

WARNING: While an invalid UTI may work when testing on your device, it will generally cause an error when uploaded to the App Store.

Fortunately, I’ve never tried submitting an app to the App Store with an illegal character in the Bundle Identifier, so I don’t know the error response or the thoroughness of checks. The fear is that if an app had snuck through with an illegal character in the Bundle Identifier, updates to that app could not be built with the current SDK. The wording from the documentation above about “generally cause and error” is a little concerning. Here’s hoping that nobody’s apps are stranded!

EDIT: Some folks have told us they’ve seen this error before SDK 3.1.2. We first saw this after installing 3.1.2 in a test project that installed on our test devices in the previous SDK version. It didn’t seem worth rolling back to that earlier versions of the SDK to verify. Instead, we just wanted to spread the word and hopefully help somebody avoid some heartache.

Comments are closed.

About QD ideas

Two college buddies created Tech-Recipes.com in 2003. Now they're writing iPhone apps as the platform for their next project: world domination.

Follow us

Follow us to get instant updates, promocodes, and give-aways.

Our Applications

more apps...

Latest tweets @qdideas