• 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: crashes loading saved file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crashes loading saved file


  • Subject: Re: crashes loading saved file
  • From: Graham Cox <email@hidden>
  • Date: Tue, 29 May 2012 16:19:08 +1000

On 29/05/2012, at 3:08 PM, James Maxwell wrote:

> I did try, btw, using encodeConditionalObject for parentNodes, sourceNodes, and superState, all of which are CbCMNodes. But the structure was no longer intact after trying this (parent connections gone), so I think I misunderstood how conditional objects are supposed to work...


That sounds like it could be a big clue, to me.

encodeConditionalObject only encodes  the object reference if it has been seen by the archiver already. If it hasn't, nil is encoded. So if things are breaking when you use it, it means that parts of the object graph you think you encoded were not.

It's pretty useful for archiving backpointers (though I agree that recreating these rather than archiving them is probably safer).

Assuming that your graph has a root node, archiving from root to leaves should be OK, but you should use encodeConditionalObject for any object you think you should have already archived (like parent nodes).

Another issue could be that if you are storing your parent and child nodes in an array, you probably have pretty solid retain cycles all over the place. Backpointers should almost always be weak (nonretained) references, which calls for special treatment if you want to put them in an array (use [NSPointerArray pointerArrayWithWeakObjects]).

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: crashes loading saved file
      • From: James Maxwell <email@hidden>
References: 
 >crashes loading saved file (From: James Maxwell <email@hidden>)
 >Re: crashes loading saved file (From: Fritz Anderson <email@hidden>)
 >Re: crashes loading saved file (From: James Maxwell <email@hidden>)
 >Re: crashes loading saved file (From: Roland King <email@hidden>)
 >Re: crashes loading saved file (From: James Maxwell <email@hidden>)
 >Re: crashes loading saved file (From: James Maxwell <email@hidden>)
 >Re: crashes loading saved file (From: Quincey Morris <email@hidden>)
 >Re: crashes loading saved file (From: James Maxwell <email@hidden>)
 >Re: crashes loading saved file (From: Quincey Morris <email@hidden>)
 >Re: crashes loading saved file (From: James Maxwell <email@hidden>)

  • Prev by Date: Re: crashes loading saved file
  • Next by Date: Re: crashes loading saved file
  • Previous by thread: Re: crashes loading saved file
  • Next by thread: Re: crashes loading saved file
  • Index(es):
    • Date
    • Thread