KVO notification not properly propagated isuse
KVO notification not properly propagated isuse
- Subject: KVO notification not properly propagated isuse
- From: Marc Van Olmen <email@hidden>
- Date: Sun, 15 Mar 2009 17:02:46 -0400
hi,
Tracing an issue where a KVO notification wasn't propagated to all
objects.
I added observation to an array controller
[mArrayController addObserver: self
forKeyPath:@"arrangedObjects.photoTransformationSettings.filmType"
options:0
context:kMyContextPtr];
and notification
- (void)observeValueForKeyPath:(NSString *)theKeyPath
ofObject:(id)theObject
change:(NSDictionary *)theChange
context:(void *)theContext
was never called, but I had a few other KVO that were bound directly
to one of those objects that worked.
So after some debugging I realized that the cause was the
ArrayController, and the fix for this was the following.
The array controller also had some KVO defined itself and
- (void)observeValueForKeyPath:(NSString *)theKeyPath
ofObject:(id)theObject
change:(NSDictionary *)theChange
context:(void *)theContext
{
... existing code
// This line was added:
[super observeValueForKeyPath: theKeyPath ofObject:theObject
change:theChange context:theContext];
}
And then the above KVO worked. So I'm curious now why I need to add
[super observeValueForKeyPath: theKeyPath ofObject:theObject change:t
Because the documentation doesn't say anything about that. Is there a
documented reason when you have to call [super
observeValueForKeyPath ...]?
cheers
marc
_______________________________________________
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