26 NSUserDefaults

When you start an app for the first time, it uses its factory settings. As you use it, a good app learns your preferences. Where are your preferences stored? Inside each app bundle there is a plist that holds the user’s preferences. As a developer, you will access this plist using the NSUserDefaults class. The preferences plist for your app can also be edited by the Settings app. To allow this, you create a settings bundle inside your app.

In this chapter, you will teach Homepwner how to read and write user preferences. Then you will create a settings bundle.

NSUserDefaults

The set of defaults for a user is a collection of key-value pairs. The key is the name of the default, and the value is some data ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.