Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO observeValueForKeyPath, not reflecting changes



Hello folks,
   I've got a pretty simple (or so I thought) KVC/KVO where I'm wanting
to observe
changes in an NSTableView column.

I register as an observer with

  :
  [theArrayController addObserver:self forKeyPath:@"selection.dValue"
                      options:(NSKeyValueObservingOptionNew |
NSKeyValueObservingOptionOld)
                      context:@"dValue"];
  :


Then I have the KVO:

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void*)context
{
  if ([keyPath isEqualToString:@"selection.dValue"] && context ==
@"dValue")
    {
      NSLog(@"change = %@", change);
      id v = [change valueForKey:NSKeyValueChangeNewKey];
      NSLog(@"v=%@", v);
    }
}


When I change a value in "dValue"-column the
observeValueForKeyPath:ofObject:change:context always returns:

    change = {kind = 1; new = <null>; old = <null>; }
    v=<null>

Searching through the different lists I've found one that said this was
a bug but that was in 2004.
My code snippet is almost exactly what is in the "Key-Value Observing
Programming Guide"

Any ideas? Or does anyone know if this IS a bug and any work-arounds?

Thanks in advance,
Steven
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.