• 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
Re: n00b cocoa bindings question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: n00b cocoa bindings question


  • Subject: Re: n00b cocoa bindings question
  • From: Jonathon Mah <email@hidden>
  • Date: Wed, 9 May 2007 23:14:13 +0930

Hi Luke,

On 2007-05-08, at 09:20, Luke Evans wrote:

// "Buffer key presses" boolean preference
        [self bind:@"bufferKeys"
            toObject:userDefCtrl
            withKeyPath:@"values.keyboardBuffering"
            options:[NSDictionary dictionaryWithObject:[NSNumber
numberWithBool:YES] forKey:@"NSContinuouslyUpdatesValue"]
        ];

// ... snip

Now, after a bunch of head scratching at the somewhat opaque runtime error:
... *** -[NSCFString charValue]: selector not recognized [self = 0x1e3d8]

That exception shows that the the user defaults controller is reading the keyboardBuffering value as a string, and trying to convert it into a boolean (by calling -charValue, which is implementation speak for calling -boolValue). When you changed your methods to take an int, everything is fine because NSString does respond to -intValue.


I don't know why it would be reading the value as a string. Perhaps you are registering default defaults and supplying it with a string, or perhaps you managed to get a string stored in your preferences file. Maybe it has even changed itself to an NSNumber by now (by your usage of an int).

If all else fails, you can use [[NSUserDefaults standardUserDefaults] boolForKey:@"keyboardBuffering"], and register to receive the NSUserDefaultsDidChangeNotification.



Jonathon Mah
email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: n00b cocoa bindings question
      • From: Luke Evans <email@hidden>
References: 
 >n00b cocoa bindings question (From: Luke Evans <email@hidden>)

  • Prev by Date: World Builder Type Application
  • Next by Date: Re: Model change behind NSTreeController's back
  • Previous by thread: n00b cocoa bindings question
  • Next by thread: Re: n00b cocoa bindings question
  • Index(es):
    • Date
    • Thread