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!
To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.
As you saw in the section called “Revisions”, revision numbers in Subversion are pretty straightforward—integers that keep getting larger as you commit more changes to your versioned data.
"svn info --show-item revision" will give the current revision to which the current directory is updated.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With