Re: NSUserDefaultsController
Re: NSUserDefaultsController
- Subject: Re: NSUserDefaultsController
- From: James Spencer <email@hidden>
- Date: Sun, 9 Nov 2003 09:44:38 -0600
On Nov 8, 2003, at 11:30 PM, Scott Anguish wrote:
are you setting the initial values for the NSUserDefaultsController
anywhere? I found that it had to be in a +initialize method that
would get called early in the load. (like AppDelegate)
Thank you very much, both you Scott and mmalc for helping me work this
out. It turns out my original problem was much more fundamental than
any of the things you both were suggesting.
In my rush I didn't read the documentation on the controller layer
carefully enough but instead simply followed the steps in Apple's
"Writing a Preferences Pane" documentation. (What a fool I can be as
this certainly hasn't saved me any time.) In the sample application
the preference Apple uses as an example is an NSColor which, of course,
can't be stored in the preferences without converting it to a data
object. Thus, the directions have you set a value transformer. I had
done this for my text fields and as a consequence, of course, when I
got valueForKey, I got an NSData object back, not a string. (I also
tried calling using
[[[NSUserDefaultsController sharedUserDefaultsController] defaults]
stringForKey:@"myKey"]
and of course that returns nil because the object stored under myKey is
not a string.
Anyway, thank you again.
Spence
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
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.