BuySellAds.com

Read the chapters in my new book Barcodes with iOS 7 as I hand them in. Great new app opportunities await!
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

%d bloggers like this: