Reputation: 61774
This is my Root.plist file:
And this is visual presentation of that bundle:
All I need to do is change the value of Latest clean to appropriate date. I do it in code:
let PBOOrdersLatestCleanKey = "PBOOrdersLatestCleanKey"
let defaults = [PBOOrdersLatestCleanKey: PBODateFormatter(type: .DateAndTimeSimple).stringFromDate(NSDate())]
NSUserDefaults.standardUserDefaults().registerDefaults(defaults)
NSUserDefaults.standardUserDefaults().synchronize()
But it is now working. The settings are still the same. Why?
Upvotes: 0
Views: 77
Reputation: 1120
The problem is you didn't set the object to the specific key. You just registered the defaults but for undefined key. Just try
NSUserDefaults.standardUserDefaults().setObject(PBODateFormatter(type: .DateAndTimeSimple).stringFromDate(NSDate()), forKey:PBOOrdersLatestCleanKey)
NSUserDefaults.standardUserDefaults().synchronize()
Good luck
Upvotes: 1