It assumes the following about your versions in info.plist:
- Your product version is CFBundleShortVersionString in info.plist
- Your build number is appended to your product version in CFBundleVersion
- Enter some default values in info.plist
Bundle versions string, short: 0.1.0 (CFBundleShortVersionString)
Bundle version: 0.1.0.1 (CFBundleVersion)
- Select your Target in Xcode
- Add a new run script build phase:
Project -> New Build Phase -> New Run Script Build Phase
- Paste the script below into the script box
- Build your project
build=$(sed -n '
cp Info.plist 'Backup of Info.plist'
}' 'Backup of info.plist' > Info.plist
Each time you build using that target the build number will be incremented. A backup of your info.plist is made (just in case).
You could easily extend this script to commit files to your subversion repository.
The script uses multi-line sed and I'm no sed magician. If you're looking for a sed tutorial try here.