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 throw an

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 behavior does

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

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

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