• 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 observeValueForKeyPath, not reflecting changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO observeValueForKeyPath, not reflecting changes


  • Subject: KVO observeValueForKeyPath, not reflecting changes
  • From: "Smith, Steven (MCP)" <email@hidden>
  • Date: Fri, 27 Apr 2007 14:09:55 -0000
  • Thread-topic: 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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: KVO observeValueForKeyPath, not reflecting changes
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: Re: Predicate in IB
  • Next by Date: Re: Simple Interface Connection Question
  • Previous by thread: Re: Lid opened notification?
  • Next by thread: Re: KVO observeValueForKeyPath, not reflecting changes
  • Index(es):
    • Date
    • Thread