I have a Settings.bundle in my app. In AppDelegate I have:
let appInfo = NSBundle.mainBundle().infoDictionary! as Dictionary<String,AnyObject>
let shortVersionString = appInfo["CFBundleShortVersionString"] as! String
let bundleVersion = appInfo["CFBundleVersion"] as! String
let applicationVersion = shortVersionString + "." + bundleVersion
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setObject(applicationVersion, forKey: "application_version")
In Root.plist I have:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>About</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>My Company Ltd</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Copyright</string>
<key>Key</key>
<string>application_copyright</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>0.0.0</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Version</string>
<key>Key</key>
<string>application_version</string>
</dict>
</array>
</dict>
</plist>
The problem I have is that the data is not persisted consistently in all devices. In some devices, I get all settings including user location, push notifications, app version, copyright and about. In others I only get user enabled settings only (e.g. location and push notifications).
It is not clear to me why and how to resolve this.
Thoughts?
Aucun commentaire:
Enregistrer un commentaire