Auto-increment Build Number in Xcode
When releasing new version of my iOS apps, I used to manually update the build number. However, a better approach is to have Xcode do it automatically. Let’s take a look at how to do it.
When looking for ways to automate bumping the build number in Xcode, I found this great script that will automatically increment the build number each time you build the app.
However, the original script will increment the build number by one each time the app
is build. I prefer to have a date stamp, so that I can immediately see when a build
was performed. I therefore use a build number with the date format
To make this work, I replaced the default
buildnum value with this one:
This will set the build number to a timestamp instead of incrementing it by one.
Initially, Xcode may have problems executing your script. For this to work, you will need to enable run access. Do so by running the following script from the Terminal:
sudo chmod 755 'filename'
Execute it in the same folder as the shell script, and you should be good to go.