Name

NSUserDefaults — Mac OS X 10.0

Synopsis

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.

image with no caption

@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 ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.