How to tie up my app's version number with the build in Xcode 4.2?
I am using Xcode 4.2 now. I wonder if there is a way to update my app's version (subversion) number each time I build the app. So for example, now it's 1.5.17, and then after a build, it'll be changed to 1.5.18
You can increment the build number by an sh script.
Click on Build Phase in your Project Target then Add Run Script and add the following script:
#!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" MYPROJECTDIR/MYPROJECTDIR-Info.plist) buildNumber=$(($buildNumber + 1)) /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" MYPROJECTDIR/MYPROJECTDIR-Info.plist
The answer from @WrightsCS is perfectly fine if you want to roll your own solution. If you want to try out how Apple does it internally, check out Automating Version and Build Numbers Using agvtool.