Save dictionary in userdefaults in swift 3 with xcode 8
I am using the following code to save an object to UserDefaults (previously 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 on the simulator. For some reason this is not saving the value and 'nil' is printed. Wondering if it's a simulator problem. Jan For Swift 3 UserDefaults.standard.setValue(token, forKey: "user_auth_token") print("\(UserDefaults.standard.value(forKey: "user_auth_token")!)") Working perfectly here with this..! let dict: