Automatically increment the build number every time the project is compiled.
- Select your target in your Xcode project
- Select the Build Phases tab
- Add a New Run Script Phase entry (via the + sign)
- Copy the snippet below into the shell editor
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
Make sure that your starting build number (General tab, below the version number) is set to a whole integer and not a float, e.g. 1, not 1.0!