Last active
August 29, 2015 13:57
-
-
Save adetamore/9531894 to your computer and use it in GitHub Desktop.
Auto Incrementing Build Version - iOS
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
#!/bin/bash | |
buildPlist=${INFOPLIST_FILE} | |
newVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist" | /usr/bin/perl -pe 's/(\d+)/($1+1)/eg'` | |
/usr/libexec/PListBuddy -c "Set :CFBundleVersion $newVersion" "$buildPlist" |
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
Open Target > General | |
Set build number to 0 (or desired starting number) | |
Open Target > Build Phases | |
Editor > Add Build Phase > Add Run Script Build Phase | |
Shell: /bin/bash | |
Paste the shell script |
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
NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary]; | |
NSString *appVersion = [NSString stringWithFormat:@"%@.%@", appInfo[@"CFBundleShortVersionString"], appInfo[@"CFBundleVersion"]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment