NSUersDefaults and setting for a specific domain
NSUersDefaults and setting for a specific domain
- Subject: NSUersDefaults and setting for a specific domain
- From: David Alter <email@hidden>
- Date: Tue, 26 Sep 2006 13:09:44 -0700
I'm working on a plugin. If I use NSUersDefaults to get and set the
prefs, it ends up making changes in the host applications prefs file.
I wanted to make sure the plugin prefs end up in it's own prefs
file. I was wondering if there was an easy way to insure that the
prefs are set for the correct domain.
I can get the data for the correct domain by doing the following
id value = [[[NSUserDefaults standardUserDefaults]
persistentDomainForName: @"com.mycompany.myplugin"]
objectForKey: key];
And I could set it by doing...
NSMutableDictionary * defaults = [NSMutableDictionary
dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults]
persistentDomainForName: @"com.mycompany.myplugin"]];
[defaults setObject: value forKey:key];
[[NSUserDefaults standardUserDefaults] setPersistentDomain:defaults
forName:@"ccom.mycompany.myplugin"];
But I'm guessing there is a cleaner way to do this.
Any ideas.
thank you for the help.
-dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden