On Apr 12, 2008, at 8:13 AM, [EMAIL PROTECTED] wrote:
Thanks Ken!

You're welcome.

int main(int argc, char *argv[])
{
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary* myValues = [NSMutableDictionary dictionaryWithCapacity:1];
        [myValues setDictionary:[[NSUserDefaults standardUserDefaults]
dictionaryRepresentation]];

You're grabbing all defaults from all domains with the above, and promoting them all into the NSArgumentDomain below, changing their precedence in the search order. That will probably have undesirable effects. You can get a mutable copy of just the NSArgumentDomain with this:

NSMutableDictionary* myValues = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] mutableCopy];

(You can add a call to -autorelease to that, or explicitly release it when you're done with it.)


   [myValues setObject:@"Bar" forKey:@"Foo"];
        [[NSUserDefaults standardUserDefaults]
removeVolatileDomainForName:NSArgumentDomain];
        [[NSUserDefaults standardUserDefaults] setVolatileDomain:myValues
forName:NSArgumentDomain];
        [pool release];
        
   return NSApplicationMain(argc,  (const char **) argv);
}

-Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to