I use the following code to save a UserDefaults object (formerly NSUserDefaults) using xcode 8:
let defaults = UserDefaults.standard() defaults.set(someObject, forKey: "someObject") print(defaults.object(forKey: "someObject"))
someObject is a dictionary and I am running a simulator.
For some reason this does not save the value and it prints "nil". Wonder if this is a simulator problem.
ios10 swift3 xcode8 nsuserdefaults
alionthego Jun 15 '16 at 3:33 2016-06-15 03:33
source share