Instance Method

setObject:forKey:

Sets the value of the specified default key.

Declaration

- (void)setObject:(id)value forKey:(NSString *)defaultName;

Parameters

value

The object to store in the defaults database.

defaultName

The key with which to associate the value.

Discussion

The value parameter can be only property list objects: NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. For NSArray and NSDictionary objects, their contents must be property list objects. For more information, see What is a Property List? in Property List Programming Guide.

Setting a default has no effect on the value returned by the objectForKey: method if the same key exists in a domain that precedes the application domain in the search list.

See Also

Setting Default Values

- setFloat:forKey:

Sets the value of the specified default key to the specified float value.

- setDouble:forKey:

Sets the value of the specified default key to the double value.

- setInteger:forKey:

Sets the value of the specified default key to the specified integer value.

- setBool:forKey:

Sets the value of the specified default key to the specified Boolean value.

- setURL:forKey:

Sets the value of the specified default key to the specified URL.