pritam001
pritam001

Reputation: 1827

How to add SVN revision number to iPhone Application Build?

I have tried a lot of scripts in xCode such as:

Insert Subversion revision number in Xcode

http://getsetgames.com/2009/10/21/automatically-insert-your-svn-revision-number-into-your-xcode-project/

http://www.red-sweater.com/blog/23/automatic-build-sub-versioning-in-xcode

http://www.noxeos.com/2011/09/13/xcode-build-number-svn/

http://bafford.com/2010/11/17/automatic-build-versioning-in-xcode-with-subversion/

but it wasn't work.

I need to know how to add SVN revision number to iPhone App.

Thanks!

Upvotes: 5

Views: 1892

Answers (2)

varda
varda

Reputation: 249

Please be informed Xcode 5 brought changes to svn directory format. So if you have Xcode 4 and 5 both together installed and already converted svn project directory to new 1.7 format you loose svn functionality in Xcode 4 (missing status, svnversion doesn't work and so on). Fortunately Tommy Domain published a workaround for those who still use Xcode 4 and Xcode 5 on the same mac. You could find it here. Shortly, the solution could be:

  • Close Xcode 4.
  • Download and install svn 1.7 client (download link is here)
  • Go to inside the XCode4.app package, to where the SVN binaries are:

cd /Applications/Xcode.app/Contents/Developer/usr/bin/

  • Backup svn* files by moving them to any other directory:

mv svn* backup

  • Make a symbolical link to svn 1.7 client installed package:

ln -s /opt/subversion/bin/svn* ./

After that reopen Xcode 4 and enjoy svn tools working as well as solution from Shekhar Again, thanks to Tommy's Domain blog.

Upvotes: 0

Shekhar Gupta
Shekhar Gupta

Reputation: 6218

You can try the following step, this may help you out:

  1. Manually set the CFBundleShortVersionString (aka "Bundle versions string, short") value in your info.plist to your major.minor build number (e.g. 1.0)

  2. Add a 'run script' build phase to your project with the following script

REV=`svnversion -nc | /usr/bin/sed -e 's/^[^:]*://;s/[A-Za-z]//'`
BASEVERNUM=`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${INFOPLIST_FILE}"`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BASEVERNUM.$REV" "${INFOPLIST_FILE}"

3.Clean and build (the Clean step forces Xcode to reprocess the info.plist).

enter image description here

Upvotes: 8

Related Questions