• 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
Archive/Unarchive Problem/Question?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Archive/Unarchive Problem/Question?


  • Subject: Archive/Unarchive Problem/Question?
  • From: Dave <email@hidden>
  • Date: Thu, 04 Feb 2016 19:02:45 +0000

Hi,

I have an object LTWNetwork that contains the following properties:


NSMutableArray*			 pNetworkArray;			//Contains an Hierarchical Array of LTWNetworkNode’s
NSMutableDictionary*		 pNetworkDict				//Contains a Hierarchical Dict of LTWNetworkNode’s
NSMutableDictionary*		 pNetworkFlatDict			/Contains Flat Dictionary of Key-LongID/LTWNetworkNode’s


LTWNetworkNode	has linkage (among other) properties:

LTWNetworkNode*		 pNetworkParentNode			//Reference to Parent
NSMutableArray*		 pNetworkChildArray			//References to Children
NSMutableDictionary*	 pNetworkChildDict				//References to Children

The important thing to remember is that a LTWNetworkNode in the above collections is only present *once*, e.g. all three collections refer to the SAME objective-C object.

Forgetting about the pNetworkDict and pNetworkChildDict properties for the moment and just concentrating on the pNetworkArray, I’ve written a self-test method that checks this array, and, after a New Network is created it passed the self-test, e.g.

Parent == ChildNode[n].Parent 		//Compare Object Pointers…….

However, after I unarchive this object, the pNetworkParentNode property is nil.

Please see my other thread regarding not being able to inspect this object with the debugger - it shows it as an empty collection, so I can’t easily fish about inside the object to spot anything in the debugger. But from the self-test method pNetworkChildArray is setup fine, it’s just the Parent that isn’t working.

Looking at the class in question, here is the relevant code:

initWithCoder:
self. pNetworkParentNode    = [theCoder decodeObjectForKey:@"pNetworkParentNode"];

encodeWithCoder
[theCoder encodeObject: self. pNetworkParentNode forKey:@"pNetworkParentNode"];

copyWithZone:
myObjectCopy. pNetworkParentNode = self. pNetworkParentNode;				//SHOULD THIS BE [self. pNetworkParentNode copy]; ?????

—————————————

I was wondering about copyWithZone, should I use copy for this? If I don’t would it cause this property to be restored as nil?

I’m really confused as to what is going wrong and not having a debugger isn’t helping, any help greatly appreciated…...

All the Best
Dave




_______________________________________________

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: Archive/Unarchive Problem/Question?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Protocol extensions returning self
  • Next by Date: Archive/Unarchive Problem/Question?
  • Previous by thread: Re: Different visualization of NSTableView row in Yosemite and El Capitan
  • Next by thread: Re: Archive/Unarchive Problem/Question?
  • Index(es):
    • Date
    • Thread