Upvote:2

Aprove answer

From the docs for writeToFile:atomically:

This method recursively validates that all the contained objects are property list objects (instances of NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary) before writing out the file, and returns NO if all the objects are not property list objects, since the resultant file would not be a valid property list.

NSIndexPath is not a property list object so it can't be written to a file like this. You should be able to store the dictionary using NSKeyedArchiver since it does conform to the NSCoding protocol.


Credit Goes to: stackoverflow.com

Related question with same questions but different answers