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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.