How to do versioning for beta versions on iOS or Mac
The recommended way to do versioning of your beta versions is as follows:
- Each beta version gets an ongoing build number which increases by 1 for every version as CFBundleVersion in Info.plist
- Additionally CFBundleShortVersionString in Info.plist will contain you target public version number as a string like 1.0.0
This ensures that each beta version is uniquely identifiable, and that live and beta version numbers never ever collide.
This is how to set it up with Xcode 4:
File | New, choose
Configuration Settings File, this gets you a new .xcconfig file.
- Name it
- Add one line with this content:
BUILD_NUMBER = 1
- Then click on the project on the upper left in the file browser (the same place where you get to build settings), click on the project again in the second-to-left panel, and click on the Info tab at the top of the inner panel.
- There, you can choose "Based on Configuration File" for each of your targets for each of your configurations (debug, release, etc.)
- Select your target
- Select the
Buildenter the value:
- Select the
Add Build Phase
Add Run Script
- Add the following content:
if [ "$CONFIGURATION" == "AdHoc_Distribution" ] then /usr/bin/perl -pe 's/(BUILD_NUMBER = )(\d+)/$1.($2+1)/eg' -i buildnumber.xcconfig fi
AdHoc_Distributionto the actual name of the Xcode configuration you are using for beta builds