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