Memention Blog

Ad Hoc changes - build time versioning

Testing is crucial to find bugs but also to get a feel of the user interface for an app, specially iPhone apps which can make it or fail depending how good the user interface is designed.

If you want to distribute a pre-release version of an app for the iPhone one should create an Ad Hoc version. Installing Ad Hoc versions into iTunes is very easy, just drag’n’drop the app bundle onto iTunes. But installing updates without updating the bundle version number in the Info.plist opens for some uncertainty of what version actually is installed and run on the iPhone. You might get a question about installing the updated version into iTunes but as there might be a version with the same version number installed on the iPhone the new will not get installed on it.

One can manually update the bundle version number before sending the updated version to the Ad Hoc crew. But this can easily be forgotten and sending updates to itunesconnect may have to managed too, well if one want an increasing release number series without holes.


As I am pretty lazy and computers should be good at handling tedious task I wrote a small build script that adds a 12 digit date number to the version numbers. This includes up to the second when the app was compiled.

The build script was placed first in the series of build steps and changed to use /bin/bash as the shell.

Below is the actual script.

# get the previous bundle version number without the date number
export VERSION=`/usr/libexec/PlistBuddy "$TARGET_BUILD_DIR/$INFOPLIST_PATH" \
-c "Print CFBundleVersion" | sed -E 's/.[0-9]{12}//g'`

# get current date and time number
export DATE=`date +%y%m%d%H%M%S`

# update the bundle version number
/usr/libexec/PlistBuddy "$TARGET_BUILD_DIR/$INFOPLIST_PATH" \
-c "Set CFBundleVersion $VERSION.$DATE"

# convert back to binary format
plutil -convert binary1 "$TARGET_BUILD_DIR/$INFOPLIST_PATH"


I started to use this method on our Chess app which later was accepted on itunesconnect having this version number format. The version number presented in iTunes and the App Store seem to be the number entered when submitting the app to the App Store. As you can see in the image to the left I compiled it pretty late on September 25th.

Hope this can help making Ad Hoc life a little easier for others as it helps me being even lazier.

By Edward Patel, 17 Oct 2009

Show comments


Throwing pebbles12 Jul 2013
Provision this!30 Aug 2012
Break what?18 Aug 2011
That old thing04 May 2011
Removing a Step15 May 2010
Make It Work22 Feb 2010
KISS server31 Jan 2010
tig on Mac12 Dec 2009
The XML Runner31 Oct 2009
Get some software from Memention
Powered by Jekyll and Disqus.
Copyright © 2010-2013 Memention AB