• 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
NSFileWrapper NSKeyedArchiver and Mutability
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileWrapper NSKeyedArchiver and Mutability


  • Subject: NSFileWrapper NSKeyedArchiver and Mutability
  • From: Trygve Inda <email@hidden>
  • Date: Mon, 24 Jun 2013 15:53:41 -0700
  • Thread-topic: NSFileWrapper NSKeyedArchiver and Mutability

NSMutableDictionary* myMutDict = [[NSMutableDictionary alloc] init];
NSData* myMutData = [NSKeyedArchiver archivedDataWithRootObject:myMutDict];

If I unarchive this, I was under the impression that it would return an
immutable object.

However, if I do:

NSFileWrapper* myWrapper = [[[NSFileWrapper alloc]
initRegularFileWithContents:myMutData ] autorelease];

[myWrapper setPreferredFilename:myDataName];

[[fileWrappers objectForKey:someKey] addFileWrapper: myWrapper];

And then later read it back in:

NSData* myData = [aWrapper regularFileContents];

NSMutableDictionary* aMutDict = [NSKeyedUnarchiver unarchiveObjectWithData:
myData ];

I end up with a mutable dictionary.

So...

Will NSKeyedArchiver / NSKeyedUnarchiver preserve mutability?

Will NSFileWrapper initRegularFileWithContents / regularFileContents
preserve mutability?

Thanks,

Trygve



_______________________________________________

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: NSFileWrapper NSKeyedArchiver and Mutability
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Getting the location of the Library
  • Next by Date: Re: Why is it wrong to have relationships without an inverse in Core Data?
  • Previous by thread: Protocol Buffers in iOS?
  • Next by thread: Re: NSFileWrapper NSKeyedArchiver and Mutability
  • Index(es):
    • Date
    • Thread