Virtually all applications need to store and retrieve preferences. Preferences 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 user preferences and noncritical configuration information. Core Foundation Preference Services provides a simple and standard way to maintain preferences for both types of uses.
Preference Services allows 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 user name, application ID, and host (computer) name. This mechanism allows you to create preferences that apply to different classes of users. For example, using Preference Services you can save a preference value that applies to
Preference Services has a high-level API that is appropriate for the majority of situations. This API makes it very simple to store application preferences to the default domain (current user, any host) and to retrieve preferences by searching all relevant domains. Preference Services supports sharing preferences among a suite of applications. There is also a low-level API that allows you to specify the exact domain of a preference value when necessary.
Preference Services stores preference values in each user's home directory, specifically
~/Library/Preferences.
Preference Services uses the Core Foundation Property List types to store and retrieve preference values. Readers unfamiliar with property lists should consult the chapter "Core Foundation Property List Services" for more information.