I would like to save the content of a NSMutableDictionary object to a file. How do I do this ? I already know how to do this task with a NSDictionary object but I don\'t know ho
NSMutableDictionary
is a subclass of NSDictionary
: you can use it anywhere you'd use NSDictionary
. Literally, just pass the object through to the same code you use for NSDictionary
right now.
In a more general sense, if you ever actually need to get a truly immutable NSDictionary
from an NSMutableDictionary
, just call copy
on the NSMutableDictionary
.
Other approaches include [NSDictionary dictionaryWithDictionary:]
or [NSDictionary alloc] initWithDictionary:]
, which all amount to essentially the same thing.