Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
14 User Defaults
Many applications allow you, as the user, to configure their behavior or appearance. Cocoa provides a simple means of storing such preferences in the user’s defaults database.
NSUserDefaults
The NSUserDefaults class is your interface to the user’s defaults database. With it you can register factory defaults, set the user’s defaults, and read the defaults back out as needed. You can think of it as a very fancy dictionary.
Your application can register a set of defaults “from the factory.” These are the defaults that your application uses when users have not made their own configuration selections. These factory defaults are registered programmatically every time your application is launched.
When ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access