Created
April 28, 2014 10:10
-
-
Save viktorbenei/11367575 to your computer and use it in GitHub Desktop.
Auto increment build number of Xcode project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Paste this into a new "Run Script" Build Phase (as described here: http://stackoverflow.com/a/15483906/974381) | |
# | |
# Tip: drag-and-drop your new Run Script to run before the "Compile Sources" Phase! | |
# | |
# Source: http://stackoverflow.com/a/15483906/974381 | |
# | |
# How to get version numbers in code? | |
# NSString *buildString = infoDictionary[(NSString*)kCFBundleVersionKey]; | |
# NSString *versionString = infoDictionary[@"CFBundleShortVersionString"]; | |
# | |
#!/bin/bash | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNumber=$(($buildNumber + 1)) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment