• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get objects to not be encoded with NSArchiver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get objects to not be encoded with NSArchiver


  • Subject: Re: How to get objects to not be encoded with NSArchiver
  • From: Chris Kane <email@hidden>
  • Date: Tue, 2 Apr 2002 18:01:01 -0800

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.

  • Follow-Ups:
    • Re: How to get objects to not be encoded with NSArchiver
      • From: Rosyna <email@hidden>
    • Re: How to get objects to not be encoded with NSArchiver
      • From: "John C. Randolph" <email@hidden>
References: 
 >How to get objects to not be encoded with NSArchiver (From: Rosyna <email@hidden>)

  • Prev by Date: Re: Toplevel Objects in NIB files
  • Next by Date: Re: NSData question
  • Previous by thread: Re: How to get objects to not be encoded with NSArchiver
  • Next by thread: Re: How to get objects to not be encoded with NSArchiver
  • Index(es):
    • Date
    • Thread