5

I am adding "Version Detail" in settings.bundle. What could be a better way to set that identifier, I have seen few do it through code other's use the run script with Plistbuddy.

Is it like that if you use plistbuddy, it show's the updated version details immediately even if you do not open the app. after version update from app. store?

If done through code, one has to open the app. to see the update in the settings.

NNikN
  • 3,720
  • 6
  • 44
  • 86

1 Answers1

10

Here's a PlistBuddy example:

#
buildPlist="Info.plist"
settingsPlist="Settings.bundle/Information.plist"

# Get the existing buildVersion and buildNumber values from the buildPlist
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBuildVersion" $buildPlist)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist)

# Increment the buildNumber
buildNumber=$(($buildNumber + 1))

# Set the version numbers in the buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBuildNumber $buildNumber" $buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildVersion.$buildNumber" $buildPlist
# Set the version numbers in the settingsPlist
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $buildVersion.$buildNumber" $settingsPlist

Hope that helps!

worldofjr
  • 3,868
  • 8
  • 37
  • 49
Jim
  • 101
  • 1
  • 3