• 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 14:50:06 -0700

On Mar 19, 2009, at 12:03, email@hidden wrote:

In this narrowed down code of the bug it will log this on removeObserver
(please ignore the Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason) because I just created simple
main sample code to narrow it down:


*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Cannot remove an observer
<Observer 0x10ac00> for the key path "targetPhoto.name" from
<NSMyArrayController 0x1099d0>, most likely because the value for the key
"targetPhoto" has changed without an appropriate KVO notification being
sent. Check the KVO-compliance of the NSMyArrayController class.'

This is not a lot of help to you, but I vaguely remember a discussion on this list a couple of months ago about problems with KVO on subclassed NSArrayControllers. I can't find the thread, but I did find that someone has been here before you:


	http://www.cocoabuilder.com/archive/message/cocoa/2008/4/15/204196

Why it should fail is not clear, but it may be that the code that adds observers does something special with NSArrayControllers (but doesn't realize your class is a subclass, or can't work properly if it's a subclass).

Alternatively, it may be a side effect of the well-known defect in NSArrayController where its KVO notifications don't contain the proper new/old values.

If I understand your workaround correctly, it bypasses (what we assume to be) NSArrayController's own overrides of didChange.../ willChange... . That may get your custom property observer notifications to work properly, but my guess is that this will break (some) behavior of any objects using the NSArrayController's usual notifications.

A better workaround strategy might be to avoid subclassing NSArrayController, and find another way to achieve what subclassing was going to get for you.


_______________________________________________

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

  • Prev by Date: - (IBAction) executes normally, but then crushes.
  • Next by Date: Re: - (IBAction) executes normally, but then crushes.
  • Previous by thread: Re: 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