I have read on another post (Archiving / Unarchiving results in initForReadingWithData incomprehensible archive) that you can’t store more than 250kBytes on a NSMutableArray. Unfortunately, in order to recover such data with NSKeyedUnarchiver, you must use a NSMutableArray. I am trying to get back an image with a size around 500kB.
MTMessage *message = [NSKeyedUnarchiver unarchiveObjectWithData:data];
The error I get is :
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x0, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x0, 0x1)’
Apparently it’s a pretty common situation (even-though i have not found a solution yet). Would you have any idea of how to bypass the use of NSMutableData.
Thank you.
EDIT : Actually it says that data has a size of 524 288 bytes, which is correct, so the problem might come from the unarchiver.
NSKeyedArchiverdoes not depend on anNSArray(immutable or not).I’m also not aware of a bug correlated with NSKeydArchiver and depending on archive size.
The following code runs fine on Lion:
Please provide more code for more insight in your actual problem. Are you maybe trying to unarchive an encoded image instead of an archive?