Re: NSArchiving failing on a NSString
Re: NSArchiving failing on a NSString
- Subject: Re: NSArchiving failing on a NSString
- From: Chris Kane <email@hidden>
- Date: Sat, 26 Jul 2003 20:49:13 -0700
On Monday, July 7, 2003, at 21:52, Jeremy Faller wrote:
I have a custom class, that I am saving with an NSArchiver. I have
implemented the NSCoding protocol, and can save the item (no problem),
but restoring it causes it to bomb out. It always bombs out on the
first instance of ANY NSString I have in the class. I have swapped in
and out all the different NSStrings in the class, and they all have
the same problem.
The exact error message I am getting is:
2003-07-08 00:43:51.919 MJDirectOrders[485] An uncaught exception was
raised
2003-07-08 00:43:51.935 MJDirectOrders[485] NSString cannot decode
class version 2147483647
2003-07-08 00:43:51.936 MJDirectOrders[485] *** Uncaught exception:
<NSGenericException> NSString cannot decode class version 2147483647
MJDirectOrders has exited due to signal 5 (SIGTRAP).
Are you encoding AND decoding the various bits of information in
exactly the same order? NSArchiver requires that. If you encode A, B,
then C, you have to decode A, B, then C in that order. NSKeyedArchiver
does not require that, on the other hand.
Additionally, I notice that when I archive, the encodeWithCoder:
method is getting called twice; and, I can't figure out why.
That's normal for an NSArchiver, and I think the docs talk about that.
It's a two-pass archiver. Make sure you encode exactly the same stuff
on both passes (down to the pointer values -- no archiving of any temp
objects you create in encodeWithCoder:!).
Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.