Auto-incrementing build number setting in Xcode
Add following script under “Build Phases” as a “New Run Script Phase”. (tested with Xcode 7.2)
#!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PRODUCT_SETTINGS_PATH") buildNumber=$(($buildNumber + 1)) /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$PRODUCT_SETTINGS_PATH"
P.S. If the number becomes too big, the script can be placed in the Scheme for Archive as a “Pre-actions” item.
2 thoughts on “Auto-incrementing build number setting in Xcode”