Reputation: 1827
I have tried a lot of scripts in xCode such as:
Insert Subversion revision number in Xcode
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
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:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
mv svn* backup
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
Reputation: 6218
You can try the following step, this may help you out:
Manually set the CFBundleShortVersionString (aka "Bundle versions string, short") value in your info.plist to your major.minor build number (e.g. 1.0)
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).
Upvotes: 8