Re: Changes in KVO behavior on SL?
Re: Changes in KVO behavior on SL?
- Subject: Re: Changes in KVO behavior on SL?
- From: Ken Thomases <email@hidden>
- Date: Tue, 1 Sep 2009 20:11:17 -0500
On Sep 1, 2009, at 7:14 PM, Kevin Brock wrote:
We've got an app that is using keyValueForPath: and
observeValueForKeyPath:ofObject:change:context: to keep a status
window up-to-date.
On 10.5 it works fine. On 10.6 keyValueForPath: is called exactly
once per property. When we later create a change dictionary and
send observeValueForKeyPath:ofObject:change:context: to the observer
for a property, valueForKeyPath: isn't called again.
Huh? You have never been supposed to call -
observeValueForKeyPath:ofObject:change:context: yourself, nor
construct change dictionaries. When a property changes in a way that
KVO can't automatically track, you are supposed to call -will/
didChangeValueForKey: (or the corresponding will/didChange... methods
for set or array mutation) and KVO will generate the change
notification itself.
Likewise, there's never been any guarantee that invoking -
observeValueForKeyPath:ofObject:change:context: will provoke the
receiver to call -valueForKeyPath: on the object whose property has
changed. If the observer wants, it can rely totally on the
information in the change dictionary. If you were using will/
didChange..., then KVO can be expected to invoke valueForKey: on the
object whose property is changing, but that's not what (you say)
you're doing.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden