Ocelot
Ocelot

Reputation: 1753

iOS run script updates the settings root.plist but changes not reflecting in settings

I have an iOS app in which i have a settings bundle. The root.plist is:

Settings.bundle's root.plist

When I manually change the Item6>Titles>Item0's value and run it, it reflects the changes in device's settings page for the app.

Now, I did a run script to set build version to this field

build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" 
${PROJECT_DIR}/${INFOPLIST_FILE}`
/usr/libexec/PlistBuddy "$SRCROOT/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:6:Titles:0 $build"

The specified value for the item in Root.plist is changed (as I can see through Xcode) but it doesn't seem to be reflecting in the settings of the application on device.

Any idea why? Any fix for this weird issue? Am I missing something?

Upvotes: 1

Views: 1904

Answers (1)

Christian
Christian

Reputation: 367

The Root.plist allows you to specify default values. Default values are only used in the settings app (or when programmatically accessing the NSUserDefaults) as long as there is no real value set to the property, either programmatically or by the user. Once a value is set (you mentioned, that you manually set the version for testing purposes), the default value is ignored.

Simply delete your app (settings will also be deleted) and restart it. The settings app on the device will show your new default value.

Upvotes: 1

Related Questions