NNikN
NNikN

Reputation: 3850

PlistBuddy or code to display version information iOS

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.

Upvotes: 5

Views: 7038

Answers (1)

Jim
Jim

Reputation: 101

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!

Upvotes: 10

Related Questions