Introduction to Preferences Programming Topics for Core Foundation

Most applications need to store and retrieve preferences to allow for user customization of application behavior and provide a way to keep track of configuration settings across multiple launches. Frameworks and libraries can also use preferences to store configuration information. Core Foundation preferences provide a simple and standard way to maintain preferences for both types of use.

Preferences allow you to store values that are associated with a key that can later be used to “look up” the preference value when you need it. Key/value pairs are assigned a scope using a combination of username, application ID, and host (computer) name. This mechanism allows you to create preferences which apply to different classes of users. For example, using preferences you can save a preference value that applies to:

Preferences has a high-level API which makes it very simple to store and retrieve application preferences using the default scope (current user, any host) which is appropriate for the majority of situations. There is also a low-level API which allows you to specify the exact scope of a preference value when necessary.

Preferences uses the Core Foundation property list types to store and retrieve preference values. Readers unfamiliar with property lists should consult the Core Foundation Topic Property List Programming Topics for Core Foundation for more information.

Organization of This Document

This topic contains conceptual information you need to understand in order to use the preferences API, and examples that demonstrate how to save and retrieve preference values. The concepts covered in this topic are:

The tasks covered in this topic are: