• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
KVO notification not properly propagated isuse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: KVO notification not properly propagated isuse
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Performance problem with GC enabled
  • Next by Date: Floating NSPanel and runModalForWindow: problems
  • Previous by thread: Problem with emulated right click and contextual menu
  • Next by thread: Re: KVO notification not properly propagated isuse
  • Index(es):
    • Date
    • Thread