• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSUserDefaultsController Bugs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Comparing pixels in an image
  • Next by Date: Re: Bug? Not receiving mouseEntered and mouseExited events
  • Previous by thread: Re: Comparing pixels in an image
  • Next by thread: Cocoa AppleScript question
  • Index(es):
    • Date
    • Thread