On Jul 28, 2011, at 9:42 PM, Kyle Sluder wrote:

> If you're not returning precisely the same NSString instance every
> time KVO thinks you should, then you are violating the rules and KVO
> has every right to complain.
> 
> KVO doesn't do an -isEqual: on the result of your method. It does
> pointer equality. Something changed on Lion that causes it to now care
> that the return value of your method stays constant when it should.

Actually, on further thought, this can’t be true, can it? Plenty of methods 
built right into the frameworks create objects on the fly — call valueForKey: 
to retrieve a property that’s declared as an NSInteger, and you’ll get an 
NSNumber object that was created to wrap it. Send valueForKey: to an array, and 
you get a newly-created array containing the results of getting that property 
from each object in the array. Both of these times, you’re not going to have 
the same pointer on subsequent calls, and these work fine, so pointer 
discrepancies can’t be the cause of his problem.

Charles_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to