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

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


  • Subject: Re: -observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
  • From: Todd Ransom <email@hidden>
  • Date: Fri, 6 Jan 2006 11:29:33 -0700

I have never called super in my KVO methods. All you should need to do is make your changes using the observed objects. What are you trying to accomplish when the observed objects change?

Todd Ransom
Return Self Software
http://returnself.com



On Jan 5, 2006, at 1:40 PM, David Burnett wrote:

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

_______________________________________________ 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
References: 
 >-observeValueForKeyPath:ofObject:change:context: only defined for abstract class. (From: David Burnett <email@hidden>)

  • Prev by Date: WebView's mainframe returns nil during WindowDidLoad?
  • Next by Date: Re: WebView's mainframe returns nil during WindowDidLoad?
  • Previous by thread: -observeValueForKeyPath:ofObject:change:context: only defined for abstract class.
  • Next by thread: Horizontally scrolling NSTextView in IB
  • Index(es):
    • Date
    • Thread