Re: How to get objects to not be encoded with NSArchiver
Re: How to get objects to not be encoded with NSArchiver
- Subject: Re: How to get objects to not be encoded with NSArchiver
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 2 Apr 2002 18:14:08 -0800
Hmm... NSDictionary does the right thing if you archive NSNull,
doesn't it?
-jcr
On Tuesday, April 2, 2002, at 06:01 PM, Chris Kane wrote:
Implement -replacementObjectForCoder: in HostObject, to return
an NSObject (e.g., return [[NSObject new] autorelease]).
Nominally, you might return nil, but if you do that, since
these objects are buried in an NSDictionary, the dictionary
will blow up on unarchiving a nil object. [For advanced
developers, this previous sentence is food for thought: what
_is_ the right behavior, and whose responsibility is it to have
the right behavior? I've just come to my own conclusion; it
surprises me a bit that we've never gotten a complaint about
this, that I can recall. Probably just very uncommon.]
Chris Kane
Cocoa Frameworks, Apple
On Tuesday, April 2, 2002, at 12:36 AM, Rosyna wrote:
I have a menu I'm archiving to a data stream with NSArchiver.
Some of the menu items have a representedObject if an
NSDictionary, this NSDictionary contains some important
information as well as a not so important class named
"HostObject" (subclass of NSObject). When the menu is
archived, it adds the HostObject instances to the archive. I
do not want this as an application that is reading the
archived object does not understand HostObject or how it
works, and therefore cannot be unarchived.
Is there anyway to prevent HostObject from being archived or
unarchived?
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it
helps me remember what we were talking about.
Thanks. _______________________________________________
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.
_______________________________________________
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.
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.