Re: Accessing preferences of another application
Re: Accessing preferences of another application
- Subject: Re: Accessing preferences of another application
- From: Dimitri Bouniol <email@hidden>
- Date: Wed, 23 Aug 2006 15:31:44 -0700
I don't understand NSUserDefaults too well, but I think you'll want
to use the addSuiteName method of NSUserDefaults:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Classes/NSUserDefaults_Class/Reference/Reference.html#//apple_ref/occ/
instm/NSUserDefaults/addSuiteNamed:
On Aug 22, 2006, at 3:49 PM, Dragan Milić wrote:
Hi all,
I know there must be a way to do this what I want, I just wasn't
able to find it reading documentation of NSUserDefaults class. I've
got an application with a bundle identifier, say,
"com.mysite.myApp" and I want to share preferences of that
application between it and another application, actually a plug-in
of another application. So in my application I use [NSUserDefaults
standardUserDefaults] instance, as usually. Now, I want to access
the same preferences (basically the same .plist file) from within
mentioned plug-in. So far, I've been using CFPreferences and
specifying "com.mysite.myApp" as identifier argument to every
CFPreferences function call and it worked flawlessly.
Unfortunately, with CFPreferences there isn't a way to define some
kind of default preferences values to be used if there's no
corresponding user-set value in the saved settings (.plist file),
as there is with -[NSUserDefaults registerDefaults:] method. That
brings me back to Cocoa. So far, I haven't manage to access
preferences stored in "com.mysite.myApp.plist" file. I've tried to
instantiate my own NSUserDefaults instance with -alloc and -init,
and than to send it -addSuiteNamed:, passing my app identifier as
an argument, I've also tried with -setPersistantDomain:forName:,
but without success.
Any suggestions? Please note that I also need to register default
preferences values with -registerDefaults: every time the plug-in
(that is its hosting app) is launched. Thanks.
Cheers,
Milke
--
The world's biggest Apple fan,
Dimitri Bouniol
email@hidden
_______________________________________________
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