Re: KVC broken in 10.4.4 on Intel?
Re: KVC broken in 10.4.4 on Intel?
- Subject: Re: KVC broken in 10.4.4 on Intel?
- From: Da Woon Jung <email@hidden>
- Date: Mon, 30 Jan 2006 11:07:41 +0900
2006/1/30, Shawn Erickson wrote:
>
> On Jan 28, 2006, at 6:30 PM, Da Woon Jung wrote:
>
> > Hi,
> >
> > On my PowerBook G4 (PPC), the following works fine:
> >
> > - (void)setFaintestVisible: (float)aValue
> > {
> > NSLog(@"%f", aValue);
> > }
> >
> > //...elsewhere, inside a method...
> >
> > [self setValue:[NSNumber numberWithFloat: 7.9f]
> > forKey:@"faintestVisible"];
> >
> > // Prints 7.900000
>
> In the above why not just do...
>
> [self setFaintestVisible:7.9f];
>
> If someone is using KVO they will still get notified of the change if
> you use your accessor directly.
That would defeat the purpose somewhat of using KVC... This is how
it's actually being used:
id key;
NSDictionary* defaultsDictionary = [self findUserDefaults ];
if ( defaultsDictionary == nil ) return;
NSEnumerator* keys = [ defaultsDictionary keyEnumerator];
while ( (key = [keys nextObject]) )
{
[self takeValue: [defaultsDictionary objectForKey: key] forKey: key];
// takeValue:forKey: is deprecated, but so what?
}
The keys like "faintestVisible" are not ivars and the set... methods
are not trivial mutators but call methods on other classes, etc. I
have a lot of keys, and by using KVC it becomes very easy to
batch-synch user defaults.
I've worked around the issue for now by converting all my (float) and
(double) scalar arguments to (NSNumber *). I'd have filed a bug report
earlier, but by the time I'd tested on the DTK, MacWorld was
happening. Better late than never :-/
Cheers,
DW
_______________________________________________
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