Re: Using NSUserDefaults from a bundle-less app
Re: Using NSUserDefaults from a bundle-less app
- Subject: Re: Using NSUserDefaults from a bundle-less app
- From: David Thorup <email@hidden>
- Date: Thu, 3 Apr 2003 19:17:15 -0700
On Thursday, April 3, 2003, at 06:29 PM, ROSE,ROBERT W
(HP-Corvallis,ex1) wrote:
Hi, I've got a bundle-less background application that uses Cocoa, and
I
would like to be able to use NSUserDefaults from it so that my
foreground
app can read information out of the defaults that are saved..
Unfortunately, I can't find a way to specify what domain the
background app
should use. Currently I'm trying this:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject: foo forKey: bar];
Try something like this:
NSMutableDictionary* dict;
dict = [defaults persistentDomainForName: @"your.domain.name"];
if (dict == nil)
dict = [NSMutableDictionary dictionaryWithCapacity:5];
[dict setObject: foo forKey: bar];
[defaults setPersistentDomain: dict forName: @"your.domain.name"];
That should do it for you.
____________________________________
Dave Thorup
Software Engineer
email@hidden
voice: 801-805-9422
www.corda.com
Interactive data driven graphics.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.