Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Subclassing NSUserDefaultsController

Subclassing NSUserDefaultsController
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 19, 2003, 06:33 PM
 
Im writting a system preferences pane and Im wondering if there is a method I can override in a subclass of NSUseDefaultsController such that my preferences are written to a different domain. I.E. com.beardedllama.irofferpref as opposed to com.apple.systempreferences.

Or am I going about this the wrong way? Should I instead be managing these preferences with NSObjectController? And then hook up the action of each of the UI elements to a method that writes out the NSObjectController's content to the appropriate domain?
3R1C
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 19, 2003, 07:04 PM
 
You have to use persistentDomainForName:

http://cocoadevcentral.com/articles/000040.php
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Nov 19, 2003, 07:36 PM
 
Originally posted by Diggory Laycock:
You have to use persistentDomainForName:

http://cocoadevcentral.com/articles/000040.php
Yes I know. How do i integrate that with NSUserDefaultsController?

Let me give a little info. I have a system preferences pane that currently works great. My preferences are nicely written to my domain. What Im experimenting with is apples new NSUserDefaultsController.

So.. Does anyone know if its possible to subclass NSUserDefaultsController such that preferences are written to a different domain? If noe via subclassing, then some other way?
3R1C
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 20, 2003, 04:36 PM
 
Oh - sorry, I haven't looked at the new stuff in Panther yet.
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Nov 21, 2003, 01:48 AM
 
Doesn't look like there's a straightforward way to make NSUserDefaultsController use anything other than the standard (app) domain for reading and writing, which is a shame.

You could use initWithDefaults:initialValues: and provide a subclass of NSUSerDefaults which uses a specific domain, but writing that NSUserDefaults subclass may well be as much work as writing your own replacement for NSUserDefaultsController.
Rick Roe
icons.cx | weblog
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 05:30 PM.
All contents of these forums © 1995-2009 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.4 © 2000-2009, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2