It’s a pain to build project in Xcode only to find out later that you forgot to update the build number.
I’ve used various techniques to accomplish this in the past, and I’m quite happy with this approach. Essentially, at build time, it uses PlistBuddy (which i had never heard of before) to get the build number out of your Info.plist
file, update it, and re-set it in the Info.plist
Under each target you want to auto-increment the build number, at the bottom select Add Build Phase
and select Add Run Script
.
In the contents of the script copy the source code from below, updating the correct path to your Info.plist
file.
Next, re-order the Run Script
phase so that it happens as the second step. You want to make sure that the post-incremented value is what is actually included in the application so you need to run this first.