Saturday, July 30, 2011

Auto incrementing version numbers in Xcode

Over the last month or so i've had to kick out a lot of betas for a project. Seeing as i use the fantastic Test Flight. I have to change the version number before i upload each build otherwise Test Flight will overwrite an existing build which is the last thing that we want.

I don't think anyone actually enjoys editing a plists, whether its in Xcode plist editor or the down and dirty XML. So has a result it was the perfect opportunity to get familiar with xcode's build process, and how to tie external scripts into it.

I use 3 segment version numbers (1.1.1), where the first digit is the major version, second digit is the minor version, and the 3rd digit is the build. For the benefit of the team, i wanted to have the latest commit hash in the build number so that people could quickly reference it and know whats going on.

With some direction from this post by Duane Sibilly i was able to hack together the below.

No comments: