• 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 valueForUndefinedKey:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUserDefaultsController valueForUndefinedKey:


  • Subject: NSUserDefaultsController valueForUndefinedKey:
  • From: Richard Somers <email@hidden>
  • Date: Fri, 19 Mar 2010 22:04:38 -0600

When moving a slider in a preference panel I sometimes get an error.

2010-03-19 01:46:49.860 MyApp[4249:10b] Error setting value for key path values.ABRadius of object <NSUserDefaultsController: 0x169c00>[applies immediately: YES] (from bound object <NSSlider: 0x6707de0> with object ID 59 in Nib named ABPreferencePanel.nib): [<NSCFType 0x168ec0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key radius.

2010-03-19 16:55:16.415 MyApp[5710:10b] Error setting value for key path values.ABRadius of object <NSUserDefaultsController: 0x1696e0>[applies immediately: YES] (from bound object <NSSlider: 0x622f790> with object ID 59 in Nib named ABPreferencePanel.nib): [<NSKeyValueSlowSetter 0x168970> valueForUndefinedKey:]: this class is not key value coding-compliant for the key radius.

Nowhere in the preference panel or in any class used in panel nib do I use the key "radius". The slider uses the key "ABRadius".

The factory defaults are registered like this in an app controller.

// ABAppController

NSString * const ABRadiusKey = @"ABRadius";

+ (void)initialize
{
// Register factory defaults.
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
[defaultValues setObject:[NSNumber numberWithInt:12]
forKey:ABRadiusKey];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
}


I do have a class which is completely external to the preference panel nib which binds a radius property to the sharedUserDefaultsController.

// ABExternalClass

- (id)init
{
     if (![super init])
         return nil;

     [self bind:@"radius"
       toObject:[NSUserDefaultsController sharedUserDefaultsController]
    withKeyPath:@"values.ABRadius"
        options:nil];

     return self;
}

The default implementation of bind appears to work just fine. I only want to propagate changes from the controller to the ABExternalClass radius property.

Anyway, I can not figure out why I am getting the valueForUndefinedKey: error.

--Richard

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSUserDefaultsController valueForUndefinedKey:
      • From: Richard Somers <email@hidden>
    • Re: NSUserDefaultsController valueForUndefinedKey:
      • From: Quincey Morris <email@hidden>
    • Re: NSUserDefaultsController valueForUndefinedKey:
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Three odd iPhone dev problems
  • Next by Date: Re: Lock a file in cocoa
  • Previous by thread: Re: App modal window and secondary thread
  • Next by thread: Re: NSUserDefaultsController valueForUndefinedKey:
  • Index(es):
    • Date
    • Thread