Skip to content

Instantly share code, notes, and snippets.

@akramhussein
Created November 26, 2014 20:21
Show Gist options
  • Save akramhussein/7ac998a4ed614043ef4d to your computer and use it in GitHub Desktop.
Save akramhussein/7ac998a4ed614043ef4d to your computer and use it in GitHub Desktop.
XCode Project - Set Version String And Build Number In Settings Bundle
#!/bin/sh
# TASK: Create Item in Settings.bundle Root.plist
# Get version string
versionString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE")
# Get build number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
# Set settings bundle value
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:DefaultValue $versionString (Build: $buildNumber)" "${SRCROOT}/${PROJECT}/Settings.bundle/Root.plist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment