iPhone App Developers: Get Info Version Tip

by

This is pretty simple, but something that isn’t in the default iPhone application templates in Xcode (well, under 10.5.8 anyway).

Background:

Most developers these days are putting the SCM revision number as the CFBundleVersion (either directly or by using another BUILD_VERSION user defined property and then setting the CFBundleVersion to ${BUILD_VERSION}), generally via a build script.

When building an iPhone application one generally distributes the app to testers via the Ad Hoc distribution option.  Testers will often receive multiple versions over the course of the beta cycle.   Unfortunately, there isn’t an easy default method for them to see which version is which in either iTunes or the Finder because generally you are only supposed to put the  ${CURRENT_PROJECT_VERSION} into the CFBundleShortVersionString field/property.

In default Cocoa about boxes, Cocoa automatically builds a version string of CFBundleShortVersionString (CFBundleVersion) which is really what we want.  Regrettably, iTunes 9.0.2 doesn’t do something similar when showing Get Info for iPhone applications (radar://7566172).

For Mac Applications, the Finder Get Info window seems to show the CFBundleGetInfoString, if present, or else the CFBundleShortVersionString if not (at least in 10.5.8).

Technique:

So one easy answer is to simply to define a BUILD_NUMBER user property in the info.plist file and have your SCM script populate this property with the current revision number for the build (or set it in this one place manually).  Then define your CFBundleVersion to be ${BUILD_NUMBER} (for SPOT) and include a CFBundleShortVersionString property in the info.plist file and define it to be  ${CURRENT_PROJECT_VERSION} (${BUILD_NUMBER}).  Now testers can tell versions apart simply by doing a Get Info on them in the Finder.

The next post will talk about an easy no-runtime-code method of showing this more useful version string in the iPhone Application’s settings panel and still maintaining a SPOT (single-point-of-truth) for the build number.  Until next time…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: