NSUserDefaultsController Bugs?
NSUserDefaultsController Bugs?
- Subject: NSUserDefaultsController Bugs?
- From: Alexander Rauchfuss <email@hidden>
- Date: Tue, 17 Jan 2006 13:48:18 -0800
On a recent application I decided to try out the
NSUserDefaultsController with SharedUserDefaults.
This is a sample initializer, it works fine.
+ (void)initialize
{
NSArray *pageKeys = [NSArray arrayWithObjects: @"defaultOne",
@"defaultTwo", nil];
NSArray *pageValues = [NSArray arrayWithObjects: [NSNumber
numberWithInt: 20], @"testString", nil];
NSDictionary *pageDefaults = [NSDictionary dictionaryWithObjects:
pageValues forKeys: pageKeys];
[[NSUserDefaultsController sharedUserDefaultsController]
setInitialValues: [NSDictionary dictionaryWithObject: pageDefaults
forKey: @"somePreferences"]];
[[NSUserDefaultsController sharedUserDefaultsController]
setAppliesImmediately: NO];
}
The oddness crops up when I try to access values that have been
stored via the sharedUserDefaultsController.
This does not seem to work.
NSString *testString = [[[NSUserDefaultsController
sharedUserDefaultsController] values] valueForKeyPath:
@"somePreferences.defaultTwo"];
This does though
NSString *testString = [[[[NSUserDefaultsController
sharedUserDefaultsController] values] valueForKey:
@"somePreferences"] valueForKey: @"defaultTwo"];
Shouldn't valueForKeyPath: work in that context?
Another bit of strangeness is the behavior of the the methods revert:
and revertToInitialValues:. They seem to be reversed;
revertToInitialValues: discards unsaved changes and revert: restores
the initial defaults. Anyone notice this behavior?
Thanks,
Alexander Rauchfuss
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