On Thu, Jul 28, 2011 at 7:20 PM, Jerry Krinock <je...@ieee.org> wrote:
>> Well, is the suggestion correct? That is, is there any way that the
>> value of barDate could have changed without sending the appropriate
>> KVO notification (did you, for example change the value of barDate
>> without going through the setter?)
>
> Thank you, Clark.  I've looked at and searched the code quite a bit, and am 
> confident that I'm not accessing instance variables directly.  And there is 
> definitely something different in Lion.
>
> Has anyone else been successful binding to tricky.key.paths in Lion?  By 
> "tricky", I mean that the last "word" in the key path is not an attribute but 
> is in fact a method which formats a number or date into a string.  Example of 
> a tricky key path:

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.

If you want to use a transformer-type method, you implement
+keyPathsForValuesAffecting<<YourCleverProperty>> appropriately, that
way KVO knows when to ask for a pointer to a new NSString instance.

--Kyle Sluder
_______________________________________________

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