• 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: Question about Archives and Serialisations Programming Guide
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Archives and Serialisations Programming Guide


  • Subject: Re: Question about Archives and Serialisations Programming Guide
  • From: Dave <email@hidden>
  • Date: Fri, 05 Feb 2016 17:00:16 +0000

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 method, I was using:

self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray copyItems:YES];

and that should be - copyItems:NO

I’m not sure where I got the YES from, I think it was from a very simple example I found online. Anyway if you set it to NO, it works as expected.

Worth checking if you have this too when you shouldn’t.

AFAIK, there are no working examples of using a back link like this, if anyone wants to post my sample code to their web-site they are welcome to it, just drop me a line.

All the Best
Dave

> On 5 Feb 2016, at 16:37, Alex Zavatone <email@hidden> wrote:
>
>
> On Feb 5, 2016, at 8:46 AM, Dave wrote:
>
>>
>>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas <email@hidden> 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…….
>
> Ahhhhhhh.
>
> It would seem that the reference is being lost when the archiving happens.
>
> 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?
>
> That almost sounds crazy enough to work.
>
>> _______________________________________________
>>
>> 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
>


_______________________________________________

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: Question about Archives and Serialisations Programming Guide
      • From: Jens Alfke <email@hidden>
    • Re: Question about Archives and Serialisations Programming Guide
      • From: Graham Cox <email@hidden>
    • Re: Question about Archives and Serialisations Programming Guide
      • From: Alex Zavatone <email@hidden>
References: 
 >Question about Archives and Serialisations Programming Guide (From: Dave <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Dave <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Dave <email@hidden>)
 >Re: Question about Archives and Serialisations Programming Guide (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Question about Archives and Serialisations Programming Guide
  • Next by Date: Re: Question about Archives and Serialisations Programming Guide
  • Previous by thread: Re: Question about Archives and Serialisations Programming Guide
  • Next by thread: Re: Question about Archives and Serialisations Programming Guide
  • Index(es):
    • Date
    • Thread