Re: NSUserDefaults and mutability
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