Q:

How do I use the writeToFile method on an NSMutableDictionary?

I would like to use a method (writeToFile) only available for NSDictionary to a NSMutableDictionary object. So, how do I convert this NSMutableDictionary object to NSDictionary?

A:

NSMutableDictionary inherits from NSDictionary. So, writeToFile should be available to both classes.

A:

For those coming here genuinely looking for conversion from NSMutableDictionary to NSDictionary :
NSMutableDictionary *mutableDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
                              @"value", @"key"] mutableCopy];

NSDictionary *dict = [NSDictionary dictionaryWithDictionary:mutableDict]; //there you have it

A:

NSMutableDictionary is a subclass of NSDictionary, so the writeToFile method should be available for your object without having to do any casting or conversions.

