Saving and retrieving data from NSUserDefaults

NSUserDefaults is a great way to save small amounts of data that you want to persistent across application "sessions" (especially where a database would be overkill).

Saving data:

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:KEY_TO_IDENTIFY_INFORMATION];

In the above, we save the value: YES with the key:


Retrieving data:

[[NSUserDefaults standardUserDefaults] boolForKey:KEY_TO_IDENTIFY_INFORMATION]

What do you think? Let me know by getting in touch on Twitter - @wibosco