• 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
Re: NSUserDefaults and mutability
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults and mutability


  • Subject: Re: NSUserDefaults and mutability
  • From: Trygve Inda <email@hidden>
  • Date: Sun, 09 Mar 2008 15:50:05 +0000
  • Thread-topic: NSUserDefaults and mutability

>> Is it enough then to take the dictionary I get back and do a [dict
>> mutableCopy]?
>>
>> Will this cascade down to the "subdicts" (dicts within the top level
>> dict).
>
>
> No it won't.  mutableCopy only operates on one particular object and
> not all its contained objects.  While that behavior does sound nice in
> some situations, you'd definitely not want that in all situations.

So I am loading a dict from NSUserDefaults which says it is not mutable (but
the sub dictionaries are mutable in practice (might be just a OS bug)).

Root
   someKey    someDict (3 items)

   someDict
     keyA     dictA
     keyB     dictB
     keyC     dictC


Dicts A, B & C contain a bunch of string keys which I need to modify and
rewrite out to user defaults.

In Carbon I could do:

CFPropertyListCreateDeepCopy (kCFAllocatorDefault, localDict,
kCFPropertyListMutableContainersAndLeaves);

Is there a NSDictionary way to do this?

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: NSUserDefaults and mutability
      • From: Ken Thomases <email@hidden>
References: 
 >Re: NSUserDefaults and mutability (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Detecting resolution changes?
  • Next by Date: Re: How do I tell if the mouse button is down, independent of view, etc.?
  • Previous by thread: Re: NSUserDefaults and mutability
  • Next by thread: Re: NSUserDefaults and mutability
  • Index(es):
    • Date
    • Thread