Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jens Alfke
> On Feb 5, 2016, at 9:00 AM, Dave wrote: > > self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray > copyItems:YES]; > > and that should be - copyItems:NO Or just myArray.mutableCopy … —Jens ___ Cocoa-dev mailing list (Cocoa

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Graham Cox
> On 6 Feb 2016, at 4:00 AM, Dave wrote: > > self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray > copyItems:YES]; This is one reason why sometimes having explicit ivars for key parts of an object will save you many hours of trouble. If you had e.g: @synthesize pNet

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
On Feb 5, 2016, at 12:01 PM, Dave wrote: >> >> Would something that is the opposite of strongify/weakify work here? Sort >> of a strongify a weak reference when it comes to archiving and archive the >> strong reference? > > Sort of a Quantum reference! > >> That almost sounds crazy enough

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
Sure. That would be nice. I also recall some classes for archiving and dearchiving that use introspection that automatically handle the proper action in one line of code. For simple cases with straightforward collection classes, this is a really really really nice approach and frees us from ha

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
> On 5 Feb 2016, at 17:04, Quincey Morris > wrote: > > On Feb 5, 2016, at 07:27 , Dave > wrote: >> >> If you set it strong, then it creates a dupe of the object over and over >> again, as I said in the other thread > > a. If that’s the case, then your problem

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Quincey Morris
On Feb 5, 2016, at 07:27 , Dave wrote: > > If you set it strong, then it creates a dupe of the object over and over > again, as I said in the other thread a. If that’s the case, then your problem is nothing to do with the weak references. Something is causing those objects to be *either* archi

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
> > Would something that is the opposite of strongify/weakify work here? Sort of > a strongify a weak reference when it comes to archiving and archive the > strong reference? Sort of a Quantum reference! > That almost sounds crazy enough to work. So do Quantum computers! __

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi Alex, Found it! Well, Jean-Daniel did - Thanks again! I was barking up the wrong tree thinking it was the back links that were the problem. Using weak caused them to (correctly as it turned out) be set to nil when the node it reference is released. The problem was in the initWithCoder metho

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
On Feb 5, 2016, at 8:46 AM, Dave wrote: > >> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas wrote: >> >> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods >> in your custom classes. > > Yes, see my other thread, it decodes all the other fields but not the (weak) > back

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
> On 5 Feb 2016, at 15:07, Jean-Daniel Dupas wrote: > > Maybe an issue cause you use __weak reference which zeroed for some reason. > Can you try to use __unsafe_unretained instead and see what happen ? If you look on my other thread, you will see that I have tried this, if I use “assign” or _

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
Maybe an issue cause you use __weak reference which zeroed for some reason. Can you try to use __unsafe_unretained instead and see what happen ? > Le 5 févr. 2016 à 14:46, Dave a écrit : > > >> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas wrote: >> >> And obviously, you also add - encodeWithCod

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas wrote: > > And obviously, you also add - encodeWithCoder: and -initWithCoder: methods in > your custom classes. Yes, see my other thread, it decodes all the other fields but not the (weak) back links get set to nil most of the time……. _

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
Hi, > On 5 Feb 2016, at 13:37, Alex Zavatone wrote: > > The first question is, “Do you have any circular references?” See my other thread for answer to that, but no, its a network with a Root Object and Child Objects, similar to a NSViewController/NSView Hierarchy. So, no there are no circula

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
The first question is, “Do you have any circular references?” On Feb 5, 2016, at 8:13 AM, Dave wrote: > 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/Arc

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
And obviously, you also add - encodeWithCoder: and -initWithCoder: methods in your custom classes. > Le 5 févr. 2016 à 14:33, Jean-Daniel Dupas a écrit : > > That is your need, not your problem. > > To archive an object graph (cyclic or not), you just do [NSKeyedArchiver > archiveRootObject:

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
That is your need, not your problem. To archive an object graph (cyclic or not), you just do [NSKeyedArchiver archiveRootObject:graph toFile:@"myfile"]; > Le 5 févr. 2016 à 14:28, Dave a écrit : > > Hi, > > See my other thread on this list which explains it fully - > "Archive/Unarchive P

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
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 wrote: > > You don’t tell use what is your problem. You can pe

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Jean-Daniel Dupas
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 a écrit : > > Hi, > > I’m having problems with Back Links when Archiving/Unarchiving an Object. I > found the text bel

Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Dave
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