• 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
-observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-observeValueForKeyPath:ofObject:change:context: only defined for abstract class.


  • Subject: -observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
  • From: David Burnett <email@hidden>
  • Date: Thu, 05 Jan 2006 20:40:04 +0000

I'm trying to perform some KVO'ing

It all appears to work but I get the following message in the
Run Log.

-observeValueForKeyPath:ofObject:change:context: only defined for abstract class. Define -[FlameController observeValueForKeyPath:ofObject:change:context:]!

FlameController looks like this...

@interface FlameController : NSObject
{

...

}

- (void)observeValueForKeyPath:(NSString *)keyPath
              ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context;


@implementation FlameController

...
- (void)observeValueForKeyPath:(NSString *)keyPath
              ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context
{

    if ([keyPath isEqual:@"time"]) {
		NSLog(@"old time:  %@, new time: %@\n",
			[change objectForKey:NSKeyValueChangeOldKey],
			[change objectForKey:NSKeyValueChangeNewKey]);
    }

    [super observeValueForKeyPath:keyPath
                ofObject:object
                 change:change
                 context:context];

}
...
@end


It appears it's the call to super that generates the error, but the doc's claim that NSObject implements the KVO informal protocol. If
I take out the call to super the value does not get updated.


What I'm I doing wrong ?
Is there a better class to subclass for FlameControlller ?
Am I supposed to update the observed object myself ?

Dave


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: -observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
      • From: Todd Ransom <email@hidden>
  • Prev by Date: inspector
  • Next by Date: Re: inspector
  • Previous by thread: Re: inspector
  • Next by thread: Re: -observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
  • Index(es):
    • Date
    • Thread