NSUserDefaults $Revision$ $Date$ NSUserDefaults Foundation/NSUserDefaults.h NSObject

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 Contains defaults read from the arguments provided to the application at startup. Volitile. Application (name of the current process) Application specific defaults, such as window positions. Persistant. NSGlobalDomain Global defaults. Persistant. Language (name based on users's language) Constants that help with localization to the users's language. Volitle NSRegistrationDomain Temporary defaults set up by the application. Volitile.

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 Languages directory of the GNUstep resources).

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.

resetStandardUserDefaults Resets the shared user defaults object to reflect the current user ID. Needed by setuid processes whiich change the user they are running as. standardUserDefaults Returns a shared instance of the class containing the standard defaults for the process. userLanguages Returns the array of user languages preferences. Uses the NSLanguages user default if available, otherwise tries to infer setup from operating system information etc (in particular, uses the LANGUAGES environment variable). setUserLanguages: languages Sets the array of user languages preferences. Places the specified array in the NSLanguages user default. arrayForKey: defaultName Looks up a value for a specified default, checks that it is an array. Returns nil if it is not. boolForKey: defaultName Looks up a value for a specified default, checks that it is a boolean. Returns NO if it is not present. dataForKey: defaultName Looks up a value for a specified default, checks that it is an NSData object. Returns nil if it is not. dictionaryForKey: defaultName Looks up a value for a specified default, checks that it is an NSDictionary object. Returns nil if it is not. dictionaryRepresentation floatForKey: defaultName init initWithUser: username integerForKey: defaultName objectForKey: defaultName persistentDomainForName: domainName persistentDomainNames registerDefaults: dictionary removeObjectForKey: defaultName removePersistentDomainForName: domainName removeVolatileDomainForName: domainName searchList setBool: value forKey: defaultName setFloat: value forKey: defaultName setInteger: value forKey: defaultName setObject: value forKey: defaultName setPersistentDomain: domain forName: domainName setSearchList: array setVolatileDomain: domain forName: domainName stringArrayForKey: defaultName stringForKey: defaultName synchronize volatileDomainForName: domainName volatileDomainNames