9/2/08 2:37 AM, also sprach [EMAIL PROTECTED]:

> For what it's worth, the [sharedUserDefaultsController save:] message is still
> returning before performing the save, so if I send any other messages within
> my savePrefs method, userDefaults will still contain the old value - I'm
> beginning to wonder if this is a bug within NSUserDefaultsController.

As someone else suggested, it appears that the -save method uses a delayed
method call to update NSUserDefaults. Binding is a perfectly acceptable way
to do this. Alternatively, you can get the value directly from the defaults
controller, as it is always immediately changed there:
    
    theValue = [[shared values] valueForKey:@"thevalue"];

Some other suggestions: storing the shared defaults and controller is really
just a waste of memory. They won't change across invocations. It would also
be a good idea to keep your types consistent: a slider expects to manipulate
a numeric value, and as you see it stores its value as a number in the
prefs. Your object property should also be an NSNumber, not an NSString.
Better yet, don't store it at all, and always ask NSUserDefaults for the
value. You'll get better extensibility with this encapsulation.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to