When creating a new preference or searching for an existing one, Preference Services uses the notion of preference domains to specify the scope and location of the preference. A preference domain is identified by three pieces of information: an application ID, a host name, and a user name. Table 1-1 shows all of the preference domains, listed in the order they are searched when attempting to locate a preference value.
When using the high-level preferences functions
CFPreferencesSetAppValue
and
CFPreferencesCopyAppValue
, you need only specify the application (almost always using the constant
kCFPreferencesCurrentApp
). The preference setting function uses as the default the current user and any host domain qualifiers, meaning that the standard location for application preferences is domain number two as listed in Table 1-1. The preference copy function searches the entire domain list in order. See the section Using the High-Level Preferences API for information on using these functions.
If you need to specify an exact domain for your preference values you can use the low-level preferences functions
CFPreferencesSetValue
and
CFPreferencesCopyValue
. These functions allow you to specify all three of the domain qualifiers when setting or searching for preferences. In most cases you will specify a domain using some combination of the domain qualifer enumeration constants. See the section Using the Low-Level Preferences API for information on using these functions.