Skip navigation.
 
mlNSUserDefaultsController with defaults for another app
FROM : Keith Alperin
DATE : Wed Aug 13 06:11:30 2008

Greetings Cocoa-devs!

My app ships as a System Preferences preference pane that contains a 
faceless agent app inside it's bundle.  The agent app provides all of 
the functionality for my app. The prefpane stores preferences in the 
plist file for my app (rather than that for the host System 
Preferences app).  I've been able to make this work by sending 
persistentDomainForName: to the shared instance of NSUserDefaults.

Now i'm trying to use bindings in order to simplify displaying a 
collection of dictionaries in an NSTable.  I can see my preference 
data via an NSUserDefaultsController if i initialize it like this 
where defaultsController is actually an instance of NSObjectController:

   NSUserDefaults *defaultsInstance = [NSUserDefaults 
standardUserDefaults];
   [defaultsInstance addSuiteNamed:DOMAIN];
   NSUserDefaultsController *controller = [[NSUserDefaultsController 
alloc] initWithDefaults: defaultsInstance initialValues: nil];
   [defaultsController setContent:controller];

My NSTable shows the correct data, but when i update the information 
it is persisted back to the com.apple.systempreferences.plist file, 
and not the plist file for my app.  Craig Hockenberry posted a similar 
question about 3.5 years ago (http://tinyurl.com/5upqnp) without 
receiving many responses and google has so far turned up very little.

Is there a way for me to bind my preferences to my view that's hosted 
in another app (in this case System Preferences?).

Thank you so much,
Keith Alperin

Related mailsAuthorDate
mlNSUserDefaultsController with defaults for another app Keith Alperin Aug 13, 06:11
mlRe: NSUserDefaultsController with defaults for another app Ken Thomases Aug 13, 07:09