Closed tibr closed 12 years ago
[NSKeyedUnarchiver unarchiveObjectWithFile:] might throw an error that looks like this and results in a crash:
[NSKeyedUnarchiver unarchiveObjectWithFile:]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x62, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x30, 0x30)'
I added a catch block to handle the error. If the file is not a valid archive the cached response is removed and nil is returned as response.
Good call. I recently wrote another project that uses NSKeyedUnarchiver and found out about this ugly un-cocoa-like behavior myself. There should be an NSError, not an exception; but we have do deal with it.
[NSKeyedUnarchiver unarchiveObjectWithFile:]
might throw an error that looks like this and results in a crash:I added a catch block to handle the error. If the file is not a valid archive the cached response is removed and nil is returned as response.