NSUserDefaults

NSUserDefaults Mac OS X 10.0

This class is the entry-point into Mac OS X's user defaults database, which is how user preferences are stored and managed for applications. Instances of this class are created using the class method standardUserDefaults. This class provides methods for storing and accessing arrays, dictionaries, strings, objects, numbers, and data in an application's user defaults database.

figs/cocn_13117.gif

@interface NSUserDefaults : NSObject
 // Initializers
   - (id)init;
   - (id)initWithUser:(NSString *)username;
 // Accessor Methods
   - (void)setInteger:(int)value forKey:(NSString *)defaultName;
   - (void)setVolatileDomain:(NSDictionary *)domain forName:(NSString *)domainName;
   - (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
   - (void)setFloat:(float)value forKey:(NSString *)defaultName;
   - (void)setObject:(id)value forKey:(NSString *)defaultName;
   - (void)setPersistentDomain:(NSDictionary *)domain forName:(NSString *)domainName;
 // Class Methods
   + (void)resetStandardUserDefaults;
   + (NSUserDefaults *)standardUserDefaults;
 // Instance Methods
   - (void)addSuiteNamed:(NSString *)suiteName;
   - (NSArray *)arrayForKey:(NSString *)defaultName;
   - (BOOL)boolForKey:(NSString *)defaultName;
   - (NSData *)dataForKey:(NSString *)defaultName;
   - (NSDictionary *)dictionaryForKey:(NSString *)defaultName;
   - (NSDictionary *)dictionaryRepresentation;
   - (float)floatForKey:(NSString *)defaultName;
   - (int)integerForKey:(NSString *)defaultName;
   - (id)objectForKey:(NSString *)defaultName;
   - (BOOL)objectIsForcedForKey:(NSString *)key;
   - (BOOL)objectIsForcedForKey:(NSString *)key inDomain:(NSString *)domain;
   - (NSDictionary *)persistentDomainForName:(NSString *)domainName;
   - (NSArray *)persistentDomainNames;
   - (void)registerDefaults:(NSDictionary *)registrationDictionary;
   - (void)removeObjectForKey:(NSString *)defaultName;
   - (void)removePersistentDomainForName:(NSString *)domainName;
   - (void)removeSuiteNamed:(NSString *)suiteName;
   - (void)removeVolatileDomainForName:(NSString *)domainName;
   - (NSArray *)stringArrayForKey:(NSString *)defaultName;
   - (NSString *)stringForKey:(NSString *)defaultName;
   - (BOOL)synchronize;
   - (NSDictionary *)volatileDomainForName:(NSString *)domainName;
   - (NSArray *)volatileDomainNames;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes