BuySellAds.com

If you like my tutorials, you will love my book . It is chockful of advanced programming techniques and the only comprehensive barcode reference for serious iOS developers.
Our DNA is written in Objective-C
Jump

Quick Batch Version Bump

On my iCatalog project I have more than 40 targets (FOURTY!), all with individual info.plist. Let me share a quick command line script that lets me simultaneously bump the software version to a different value for all targets at the same time. This has proven extremely helpful.

The script I use uses the defaults tool to write the new value into the plists and then converts it back to text xml plist format.

bump_version_to.sh

#!/bin/sh
 
if [ "$#" -ne 1 ]
then
        echo "Usage: bump_version_to <version>"
        exit 1
fi
 
for FILE in `ls */*Info.plist`
do
        INFO_PLIST=`pwd`/${FILE%.*}
        defaults write "$INFO_PLIST" CFBundleVersion "$1"
        plutil -convert xml1 "$INFO_PLIST.plist"
done

Put this script into your project root. It expects the info.plist files to be one level below it. Make it executable with chmod +x. Run it passing the new version string. Boom!


Categories: Recipes

3 Comments »

  1. What I really want to know is – why do you have 40 build targets!?

  2. 😉 Many Many clients, each with their own app….. (but I will have to think of something down the road)

  3. I use a different method. I have a version.xcconfig file with just one line:

    CURRENT_PROJECT_VERSION = xxx

    And in my Info.plist I simply set once and for all ${CURRENT_PROJECT_VERSION} for the CFBundleVersion entry.

    Much simpler IMHO. You don’t even have to invoke a separate shell script from the command line. All you have to do is change the value in one file. And you can even set up a Run Script build phase to increment it automatically at each build if you fancy.

Leave a Comment

%d bloggers like this: