Skip navigation.
 
mlRe: Need NSNumber setBoolValue for KVC Compliance workaround
FROM : Ken Thomases
DATE : Tue May 27 22:55:48 2008

On May 27, 2008, at 3:41 PM, David Carlisle wrote:
> I want to put an NSMutableDictionary into my standardUserDefaults 
> with keys and boolean values [NSNumber numberWithBool:YES/NO], then 
> bind that to a table with keys and checkboxes in my preferences 
> window.  That all seems to work nicely, except that when I check 
> one of the checkboxes I find that NSNumber needs a setBoolValue 
> method to be KVC compliant.
>
> So I need an object that is both property list compliant and KVC 
> compliant for a BOOL value.
>
> Is there a standard workaround somewhere?


Are you binding to "foo.bar.boolValue"?  You should just bind to 
foo.bar.

Since an NSNumber is immutable, any request for a setBoolValue: 
method raises a red flag -- why is something trying to modify an 
NSNumber.  That thing, whatever it is, should be trying to replace 
that NSNumber.

Cheers,
Ken

Related mailsAuthorDate
mlNeed NSNumber setBoolValue for KVC Compliance workaround David Carlisle May 27, 22:41
mlRe: Need NSNumber setBoolValue for KVC Compliance workaround Ken Thomases May 27, 22:55
mlRe: Need NSNumber setBoolValue for KVC Compliance workaround Kyle Sluder May 27, 22:59