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:

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.

Need Your Help

Inserting large amount of records in MySQL database eats up memory

php mysql memory-leaks

I run a script on my server which inserts about 3000 records each minute of each ~2kB. It appears that the memory of the server gets clogged up with data from this activity. (100MB in 20min)

Is there a way to create a select list with a default value, but no drop down

html css drop-down-menu

Bit of a strange question really, but is there a way to create an select option list that display the text 'select one' but when you click it it actually doesn't drop down?