When saving a NSDictionary to file using :
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
YES or NO can be returned.
There are some methods for writing files that accept a NSError parameter.
In the case of the NSDictionary, such a method doesn't exist.
So if the writeToFile
method returns NO, how may I know what happened ?
Look at the docs for writeToFile:atomically:
to see which data types can be in a dictionary when you use this method. If you include an object not among these basic types (such as your own object), the method will return NO. In this case, to save these kinds of objects, you have to look to other means to write the data, such as using an NSArchiver and making your objects conform to the NSCoding protocol.