• 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
How to Handle Array of Dictionaries when Archiving/Unarchiving?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to Handle Array of Dictionaries when Archiving/Unarchiving?


  • Subject: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • From: Dave <email@hidden>
  • Date: Thu, 23 Jun 2016 12:21:22 +0100

Hi,

I have an Object that I Archive and Unarchive, e.g it conforms to the NSCopying and NSCoding Protocols. The Object in question contains NSArray and NSDictionary Object and I handle them like this:

initWithCoder:

myDictionary = [theCoder decodeObjectForKey:@"pLookUpDictionary "];
self.pLookUpDictionary = [[NSMutableDictionary alloc] initWithDictionary:myDictionary copyItems:NO];


encodeWithCoder:

[theCoder encodeBool: self.pLookUpDictionary forKey:@"pLookUpDictionary”];


copyWithZone:

myDictionaryCopy = [self.pLookUpDictionary mutableCopy];
myObjectCopy.pLookUpDictionary = myDictionaryCopy;


I now need to add another archivable property as so:

@property (nonatomic,strong)	NSMutableDictionary<NSString*,NSArray<LTWClassX*>*>*		pLookUpDictionaryArray;

How do I handle this in the above three methods? Specially do I need to walk the Array and do a mutableCopy on each of the Dictionaries in the Array?

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: How to Handle Array of Dictionaries when Archiving/Unarchiving?
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Re: unicode fraction symbol in a NSTextView
  • Next by Date: Re: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • Previous by thread: unicode fraction symbol in a NSTextView
  • Next by thread: Re: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • Index(es):
    • Date
    • Thread