How to auto increment Xcode project build version numbers

One slight niggle to be aware of when using Xcode projects is the bundle version, stored in the target's Info.plist
file.

During normal development this numeric value has little significance. However when you start uploading builds
elsewhere it is vital as it represents the unique identifier for that build. If this remains at the default '1'
your build will either be rejected or it may be ambiguous to which build is which.

Avoid forgetting to increment the Xcode project build version number!

The answer is to increment the bundle version manually before uploading a build somewhere, however this is something
that can be easily forgotten.

My preferred solution is to add a tiny build script to my Xcode projects that will increment the bundle version for me
every time the project is compiled. A nice side effect of this is I get a vague sense of how much work has gone into
a project simply by looking at the bundle version.

Of course the "Bundle version string, short" value must still be set manually but this is only done when preparing a
release.

Adding the automated script

In your Xcode target project settings select the "Build phases" tab.

Click the "+" button add select "New Run Script Phase"

In the script area paste this tiny script which will increment the bundle version every time the project is built: