• 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: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys


  • Subject: Re: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 19 Mar 2009 10:28:40 -0700

On Mar 19, 2009, at 09:53, email@hidden wrote:

Bug in short Terms: KVO or Bindings with a custom key like "targetPhoto"
here in my example doesn't work properly when that keyPath contains an
extra element like "targetPhoto.name" and when the object is an
NSController or (subclass because I notice this bug with
NSArrayController).


You will also see an exception when you removeObserver for that key after
you first set the key.


This sequence basically causes an exception on the removeObserver call.

 [myArraController addObserver: ... keyPath  "targetPhoto.name"  ...];
 [myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
 [myArraController removeObserver: ... keyPath  "targetPhoto.name"];

This was my initial bug that I was tracing

[myArraController addObserver: ... keyPath "targetPhoto.name" ...];
[myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
[[myArraController targetPhoto:] setName:@"the new name"]; // this DOES
NOT Trigger the KVO notification
[myArraController removeObserver: ... keyPath "targetPhoto.name"];


By the way this above code works fine in case the key is "arrangedObjects"
and do something like this:


[myArraController addObserver: ... keyPath "arrangedObjects.name" ...];
[myArraController setTargetPhoto:...]; // this Triggers the KVO
notification
[[myArraController targetPhoto:] setName:@"the new name"]; / this
Triggers the KVO notification
[myArraController removeObserver: ... keyPath "arrangedObjects.name"];

Based on what you've posted, your source code looks rather messed up. Presumably you have a NSArrayController subclass with a "targetPhoto" property. What kind of property? Is it an array object?


The first thing you need to do is to find all the error messages in your run log (and I suspect there are multiple errors, even before the exception) and post the actual message text. You almost certainly did *not* find a bug.


_______________________________________________

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: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys
      • From: email@hidden
References: 
 >Bug+Fix: NSController (and subclasses) have problems with custom KVO keys (From: email@hidden)

  • Prev by Date: Re: problems with CAAnimation
  • Next by Date: catching trigger mounts of autofs
  • Previous by thread: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys
  • Next by thread: Re: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys
  • Index(es):
    • Date
    • Thread