• 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
Problem Archiving/Un-archiving Custom Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem Archiving/Un-archiving Custom Objects


  • Subject: Problem Archiving/Un-archiving Custom Objects
  • From: Dave <email@hidden>
  • Date: Thu, 21 Jan 2016 21:47:44 +0000

Hi,

I’ve got it working using NSCoding for now and I can review to later.

I have one crashing problem though, I’m getting a crash when one of the properties in my LTWNodeInfo is dealloc. It’s an NSIndexPath class, the rest seem to be ok. i’m wondering if it is to do with the way in which I’m creating/copying it:



@property (nonatomic,copy)		NSIndexPath*			pNodeIndexPath;


in initWithCoder:

self.pNodeIndexPath = [theCoder decodeObjectForKey:@"pNodeIndexPath”];


in encodeWithCoder:

[theCoder encodeObject:self. pNodeIndexPath forKey:@"pNodeIndexPath”];

in copyWithZone:

myObjectCopy. pNodeIndexPath = self. pNodeIndexPath;			//Copy Attribute on Property



In order to work around it, I added an extra property:

@property (nonatomic,copy)		NSString*			pNodeIndexPathString;


Added to: initWithCoder:

self.pNodeIndexPathString = [theCoder decodeObjectForKey:@"pNodeIndexPathString”];

myIndexPath = [NSIndexPath newIndexPathWithPathString:self.pUIElementInfoIndexPathString];
self.pUIElementInfoIndexPath = myIndexPath;


Added to: encodeWithCoder:

[theCoder encodeObject:self. pNodeIndexPathString forKey:@"pNodeIndexPathString”];

and removed the encodeObject: self.pNodeIndexPath

in copyWithZone:


myObjectCopy. pNodeIndexPath = self. pNodeIndexPath;			                //Copy Attribute on Property
myObjectCopy. pNodeIndexPathString = self. pNodeIndexPathString;			//Copy Attribute on Property

But I still get a crash on the dealloc of pNodeIndexPath.

in dealloc:

self.pNodeIndexPath = nil;

Anyone have any ideas what I’m doing wrong?

Thanks in Advance
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: Problem Archiving/Un-archiving Custom Objects
      • From: Quincey Morris <email@hidden>
    • Re: Problem Archiving/Un-archiving Custom Objects
      • From: Jens Alfke <email@hidden>
References: 
 >How to save a Dictionary Network to a plist file? (From: Dave <email@hidden>)
 >Re: How to save a Dictionary Network to a plist file? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Subview Resizes with Superview
  • Next by Date: Re: 32-bit / 64-bit roadmap
  • Previous by thread: Re: How to save a Dictionary Network to a plist file?
  • Next by thread: Re: Problem Archiving/Un-archiving Custom Objects
  • Index(es):
    • Date
    • Thread