> 
> 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]).


Thanks, Graham. This is a good thought. I've not heard of NSPointerArray 
before… I'll look into it. It sounds like exactly the kind of structure I 
should be using.

J.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to