Re: NSUserDefaults and mutability

2008-03-09 Thread Ken Thomases
On Mar 9, 2008, at 10:50 AM, Trygve Inda wrote: In Carbon I could do: CFPropertyListCreateDeepCopy (kCFAllocatorDefault, localDict, kCFPropertyListMutableContainersAndLeaves); Is there a NSDictionary way to do this? The above. An NSDictionary is toll-free bridged to CFDictionaryRef, so go

Re: NSUserDefaults and mutability

2008-03-09 Thread Trygve Inda
>> 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 beh

Re: NSUserDefaults and mutability

2008-03-09 Thread Ricky Sharp
On Mar 9, 2008, at 5:58 AM, Trygve Inda wrote: On 8 Mar '08, at 1:57 PM, Trygve Inda wrote: Is this expected? Can I rely on it? I will never need to change dict, but I am modifying items within a known sub Dictionary. Don't rely on this; it's entirely possible this behavior could change in

Re: NSUserDefaults and mutability

2008-03-09 Thread Trygve Inda
> > On 8 Mar '08, at 1:57 PM, Trygve Inda wrote: > >> Is this expected? Can I rely on it? I will never need to change >> dict, but I >> am modifying items within a known sub Dictionary. > > Don't rely on this; it's entirely possible this behavior could change > in the future, causing your app to

Re: NSUserDefaults and mutability

2008-03-08 Thread Nick Zitzmann
On Mar 8, 2008, at 6:16 PM, Jens Alfke wrote: Don't rely on this; it's entirely possible this behavior could change in the future, causing your app to throw an exception. Something much like that happened in 10.4 (I think) — maybe it was the mutability of collections read from property lis

Re: NSUserDefaults and mutability

2008-03-08 Thread Jens Alfke
On 8 Mar '08, at 1:57 PM, Trygve Inda wrote: Is this expected? Can I rely on it? I will never need to change dict, but I am modifying items within a known sub Dictionary. Don't rely on this; it's entirely possible this behavior could change in the future, causing your app to throw an exce

NSUserDefaults and mutability

2008-03-08 Thread Trygve Inda
NSUserDefaults docs say: "Values returned from NSUserDefaults are immutable" However... NSDictionary * dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName: @"com.mycompany.myapp"]; // dict is indeed immutable and contains one key value pair subDict which is // another dictionar