Re: NSUersDefaults and setting for a specific domain
Re: NSUersDefaults and setting for a specific domain
- Subject: Re: NSUersDefaults and setting for a specific domain
- From: Chris Parker <email@hidden>
- Date: Tue, 26 Sep 2006 13:35:56 -0700
On Sep 26, 2006, at 1:22 PM, Stephen Deken wrote:
There is, but it means dropping "down" to CFPreferences. Key/value
pairs set via CFPreferences are available through NSUserDefaults and
vice-versa.
Couldn't he also do something like:
NSUserDefaults *otherUserDefaults = [[NSUserDefaults alloc] init];
[otherUserDefaults addSuiteName:@"com.mycompany.myapp"];
And then use otherUserDefaults as a normal NSUserDefaults object?
Not in front of a mac at the moment, or I'd have tested this before
sending it.
That does something slightly different which may or may not be
desirable.
Using addSuiteName: adds the requested preferences domain with the
provided name to the application's search list.
After the call to addSuiteNamed:, when asking for the value for a key,
that key could be read as if it were part of the application's
preferences itself (i.e. just using -[NSUserDefaults objectForKey:]).
If the application has a key which is the same as the bundle (in this
case), then the application's key will "win out" in the search list.
In order to set the key in the bundle's preferences, you'd still have
to use CFPreferences or the NSUserDefaults code the original poster
supplied.
.chris
--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.
_______________________________________________
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