Instance Method


Removes a given key and its associated value from the dictionary.


- (void)removeObjectForKey:(KeyType)aKey;



The key to remove.


Does nothing if aKey does not exist.

For example, assume you have an archived dictionary that records the call letters and associated frequencies of radio stations. To remove an entry for a defunct station, you could write code similar to the following:

NSMutableDictionary *stations = nil;
stations = [[NSMutableDictionary alloc]
        initWithContentsOfFile: pathToArchive];
[stations removeObjectForKey:@"KIKT"];

See Also

Removing Entries From a Mutable Dictionary

- removeAllObjects

Empties the dictionary of its entries.

- removeObjectsForKeys:

Removes from the dictionary entries specified by elements in a given array.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software