NSUserDefaults provides an interface to the defaults system, which allows an application access to global and/or application specific defualts set by the user. A particular instance of NSUserDefaults, standardUserDefaults, is provided as a convenience. Most of the information described below pertains to the standardUserDefaults. It is unlikely that you would want to instantiate your own userDefaults object, since it would not be set up in the same way as the standardUserDefaults.
Defaults are managed based on domains. Certain
domains, such as NSGlobalDomain
, are
persistant. These domains have defaults that are stored
externally. Other domains are volitale. The defaults in
these domains remain in effect only during the existance of
the application and may in fact be different for
applications running at the same time. When asking for a
default value from standardUserDefaults, NSUserDefaults
looks through the various domains in a particular order.
NSArgumentDomain
NSGlobalDomain
NSRegistrationDomain
The NSLanguages default value is used to set up the
constants for localization. GNUstep will also look for the
LANGUAGES
environment variable if it is not set
in the defaults system. If it exists, it consists of an
array of languages that the user prefers. At least one of
the languages should have a corresponding localization file
(typically located in the
As a special extension, on systems that support locales
(e.g. GNU/Linux and Solaris), GNUstep will use information
from the user specified locale, if the NSLanguages
default value is not found. Typically the locale is
specified in the environment with the LANG
environment variable.