NSUserDefaults

There are a few ways we can persist data on the iPhone. The first one is to store data securely. We can make use of the Keychain framework that Apple has provided.
NSUserDefaults is another way of storing data, but for non-sensitive info such as user settings which do not need to be encrypted. NSUserDefaults will be further explained in the next slide.

Set a value
[[NSUserDefaults standardUserDefaults] setObject:myValue forKey:myKey];

Retrieve a value
[[NSUserDefaults standardUserDefaults] objectForKey:myKey];

Synchronize
[[NSUserDefaults standardUserDefaults] synchronize];

NSUserDefaults is a simple way of storing non-sensitive data. We can set a value by calling NSUserDefaults standardUserDefaults set Object. Basically, it works like an NSDictionary. You can easily set and retrieve values.
However, this time round, you need to synchronize. Synchronize basically works like a save. After changing variables, you might want to call synchronize to save NSUserDefaults. NSUserDefaults saves every now and then, but to make sure you can simply call synchronize.