Hi, See my other thread on this list which explains it fully - "Archive/Unarchive Problem/Question?”.
Basically I need to save/restore a Network of Custom Objects….. All the Best Dave > On 5 Feb 2016, at 13:18, Jean-Daniel Dupas <mail...@xenonium.com> wrote: > > You don’t tell use what is your problem. You can perfectly encode any > structure using Keyed archivers (whether there is cycles and backlinks). > >> Le 5 févr. 2016 à 14:13, Dave <d...@looktowindward.com> a écrit : >> >> Hi, >> >> I’m having problems with Back Links when Archiving/Unarchiving an Object. I >> found the text below at: >> >> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html >> >> >> Root Object >> >> An object graph is not necessarily a simple tree structure. Two objects can >> contain references to each other, for example, creating a cycle. If a coder >> follows every link and blindly encodes each object it encounters, this >> circular reference will generate an infinite loop in the coder. Also, a >> single object can be referenced by several other objects. The coder must be >> able to recognize and handle multiple and circular references so that it >> does not encode more than one copy of each object, but still regenerate all >> the references when decoding. >> To solve this problem, NSCoder introduces the concept of a root object. The >> root object is the starting point of an object graph. To encode an object >> graph, you invoke the NSCoder method encodeRootObject:, passing in the first >> object to encode. Every object encoded within the context of this invocation >> is tracked. If the coder is asked to encode an object more than once, the >> coder encodes a reference to the first encoding instead of encoding the >> object again. >> >> 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. >> >> The last paragraph seems pertinent to my problem, so do I need to do >> something special for “weak”, back links in order to “keep track of multiple >> references to objects”? If so could some please tell me how to do this? I’m >> really struggling to get something out the door and was advised to use the >> Keyed Archiver/Unarchiver as it would be the simplest implementation…… >> >> Is this any other documentation or sample code available? There are plenty >> of trivial examples out there, no nothing I can find that works for weak >> back links, although according to all the Apple Blurb I can find, it is >> possible, they just don’t tell you how to do it that I can find! >> >> Thanks in Advance for Any Help >> All the Best >> Dave >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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/mailing%40xenonium.com >> >> This email sent to mail...@xenonium.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com