Instance Method

objectForKey:

Returns the object associated with the specified key.

Declaration

- (id)objectForKey:(NSString *)defaultName;

Parameters

defaultName

A key in the current user‘s defaults database.

Return Value

The object associated with the specified key, or nil if the key was not found.

Discussion

This method searches the domains included in the search list in the order in which they are listed and returns the object associated with the first occurrence of the specified default.

Special Considerations

The returned object is immutable, even if the value you originally set was mutable.

See Also

Getting Default Values

- URLForKey:

Returns the URL associated with the specified key.

- arrayForKey:

Returns the array associated with the specified key.

- dictionaryForKey:

Returns the dictionary object associated with the specified key.

- stringForKey:

Returns the string associated with the specified key.

- stringArrayForKey:

Returns the array of strings associated with the specified key.

- dataForKey:

Returns the data object associated with the specified key.

- boolForKey:

Returns the Boolean value associated with the specified key.

- integerForKey:

Returns the integer value associated with the specified key.

- floatForKey:

Returns the float value associated with the specified key.

- doubleForKey:

Returns the double value associated with the specified key.

- dictionaryRepresentation

Returns a dictionary that contains a union of all key-value pairs in the domains in the search list.