I'm new in IOS. Problaby i'm missing some concept. I've followed this tutorial for creating a bundle setting page.
The settings page is created and I can see 4 settings that i've created in the settings file... ok.
I'm trying to get this values when app launch with this code when app didfinishlaunchwithoptions:
//Settings:
let standardUserDefaults : NSUserDefaults = NSUserDefaults.standardUserDefaults()
print(standardUserDefaults.boolForKey("Push"))
print(standardUserDefaults.stringForKey("Idioma"))
I don't get the right configuration values... Push is enabled but I always get false, and nil in Idioma...
Update: I followed this instructions I've generated a plist file only to store defaults values and know I get the defaults values but I continue missing some concept because I want to know if any default setting is changed outside my app in the settings app of the Device. I've tested to uncheck Push value in settings of device and I still get the default value in my app... How my app knows when a default value has been changed in settings?
var myDict: NSDictionary?
if let path = NSBundle.mainBundle().pathForResource("SettingsDefaults", ofType: "plist") {
myDict = NSDictionary(contentsOfFile: path)
}
if let dict = myDict {
print(dict["Push"])
NSUserDefaults.standardUserDefaults().registerDefaults(dict as! [String : AnyObject])
NSUserDefaults.standardUserDefaults().synchronize()
}