Skip navigation.
 
mlAnyone having problems with NSArchiver/NSUnarchiver on 10.5.1?
FROM : Manfred Schwind
DATE : Thu Nov 29 22:51:53 2007

I have a strange problem:

I am using NSArchiver to archive an NSDictionary into an NSData and 
store this into the NSUserDefaults. Loading goes the other way round: 
I get the NSData from the NSUserDefaults and unarchive it back to an 
NSDictionary with NSUnarchiver.

The problem: when the NSData was archived on 10.4.x, it can not be 
unarchived on 10.5.1! I always get this error:

*** NSThread: ignoring exception '*** NSUnarchiver: inconsistency 
between written and read data for object 0xdf1e010' that raised during 
thread perform of target 0x2a64e0 and selector ...

My NSDictionary uses NSStrings as keys and the objects are very simple 
objects (no further hierarchy, just a few encoded things correctly 
implemented in initWithCoder and encodeWithCoder). I checked if there 
are any exceptions thrown in my initWithCoder routine. But there 
isn't. My own objects are unarchived without problems. The exception 
occurs in Cocoa code when it tries to unarchive the NSDictionary; none 
of my code is involved in the stack trace at the time the exception 
occurs. So the problems must be somewhere in the unarchiving of 
NSDictionary itself. It seems that Cocoa has introduced a  serious bug 
in 10.5.1 here.

I _think_ the problem does not occur when unarchiving the 10.4.x 
archive on 10.5, then archiving again on 10.5 and then going to 
10.5.1. I think the problem is only with unarchiving on 10.5.1 
archives that were created on 10.4.x.
But I still have to do additional testing here.

My question is: Has anyone seen this, too?

Regards,
Mani

Related mailsAuthorDate
No related mails found.