|
From: | Richard Frith-Macdonald |
Subject: | Re: nsuserdefaults help please |
Date: | Thu, 15 Jul 2004 05:05:27 +0100 |
On 15 Jul 2004, at 03:09, reuss wrote:
my problem is that I cant edit the values stored in volatiledomain. please look at the following: id masik = [NSUserDefaults standardUserDefaults]; id dd = [NSMutableDictionary dictionary]; [dd setObject: @"valami" forKey: @"valami"]; [masik setVolatileDomain: dd forName: @"Kukucs"];[[[masik volatileDomainForName: @"Kukucs"] mutableCopy] setObject: @"semmi" forKey: @"valami"];NSLog (@"%@", [masik volatileDomainForName: @"Kukucs"]); the result following is printed: {valami = valami} i thougth it should be: {valami = semmi} am i in mistake?
You are setting 'semmi' into a copy of the domain, not into the actual defaults system. If you want the changed value to be in the defaults, you must use setVolatileDomain:forName:
to put the new dictionary into the defaults system again.Because you are using a volatile domain, any such change, will only effect the running process. For persistent changes effecting all instances of the application, the setObject:forKey: method is
used.To make changes usable by all applications, you use setPersistentDomain:forName: with
NSGlobalDomain
[Prev in Thread] | Current Thread | [Next in Thread] |