• 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: ARCHIVING WITH CIRCULAR REFERENCES
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARCHIVING WITH CIRCULAR REFERENCES


  • Subject: Re: ARCHIVING WITH CIRCULAR REFERENCES
  • From: Generic User <email@hidden>
  • Date: Sun, 16 Feb 2003 22:41:33 -0600

Thanks Martin and Alex,

I agree Martin, it should work it seems to me. At least according to the documentation. I say this because the docs clearly say circular references are no problem, that it simply creates a token rather than a second copy of any object encountered more than once. It also says that the references to those objects will be "wired-up" properly upon decoding. As I said before, the NIB files do exactly that. The really strange thing is that I'm quite certain this worked before. Is it possible that the DEC 2002 dev tools changed the frameworks I'm compiling against but not the ones IB is using to archive its own graphs? BTW, as for NSDictionary, it conforms to NSCoding and should therefore not be of any special significance to this problem. Yes, using -description on a root object that ultimately cycles, will crash rather quickly. I often want to print out my entire object graph as a plist so I can review it. In order to do so, I traverse it and put in my own descriptions for objects that refer back up the tree.

BUT ARCHIVING IS A DIFFERENT STORY AND SHOULD SIMPLY WORK. NSARCHIVER WOULD BE WORTHLESS IF I HAD TO WRITE MY OWN ROUTINES FOR CIRCULAR GRAPHS. ONLY THE SIMPLEST OF GRAPHS WOULD NOT HAVE A CIRCULAR REFERENCE SOMEWHERE.

I thank you both for the help. Hopefully I can figure this out.

dan

On Sunday, February 16, 2003, at 10:58 AM, Alex Rice wrote:


On Sunday, February 16, 2003, at 02:25 AM, Martin Hdcker wrote:

Well, this sure does look like it should already work for you:

But this doesn't say anything about NSDictionary does it? Subclasses may or may not do it right.

NSCoder does not implement support for root objects; NSCoder's implementation of encodeRootObject: simply encodes the object by invoking encodeObject: . It is the responsibility of its concrete subclasses to keep track of multiple references to objects, thus preserving the structure of any object graphs.

OK, this jogged my memory. whitestari, remove the NSLog() calls or figure out a way to not call -description on your circular objects. I believe this is the cause of the problem, not the circular reference itself.

See the thread I started in January titled "Re: NSMutableDictionary crashing?"

http://lists.apple.com/archives/cocoa-dev/2003/Jan/01/ nsmutabledictionarycrash.txt
http://lists.apple.com/archives/cocoa-dev/2003/Jan/02/ nsmutabledictionarycrash.txt
http://lists.apple.com/archives/cocoa-dev/2003/Jan/02/ nsmutabledictionarycrash.001.txt

Alex Rice <email@hidden> | Mindlube Software | http://mindlube.com

what a waste of thumbs that are opposable
to make machines that are disposable -Ani DiFranco
_______________________________________________
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.

References: 
 >Re: ARCHIVING WITH CIRCULAR REFERENCES (From: Alex Rice <email@hidden>)

  • Prev by Date: Re: mysterious NSOutlineView crashing
  • Next by Date: Re: Hello
  • Previous by thread: Re: ARCHIVING WITH CIRCULAR REFERENCES
  • Next by thread: Image loaded/displayed at the wrong size
  • Index(es):
    • Date
    • Thread