• 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: Cannot Remove Observer Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot Remove Observer Error


  • Subject: Re: Cannot Remove Observer Error
  • From: Mark Piccirelli <email@hidden>
  • Date: Tue, 15 Apr 2008 11:31:29 -0700

How are KVO notifications for the Wine class' wineType property being done? KVO is complaining that not enough of them are being sent out. The rule for KVO-compliance in this case is that something must do [wine willChangeValueForKey:@"wineType"] before the value returned by [wine valueForKey:@"wineType"] would change and then something must invoke [wine didChangeValueForKey:@"wineType"] after the value returned by [wine valueForKey:@"wineType"] has changed. Automatic KVO notification does that, but only for changes done with [wine setWineType:aWineType], if there is such a method, or [wine setValue:aWineType forKey:@"wineType"]. If the wine type is stored in an instance variable and something changes the value of that ivar without doing -willChangeValueForKey:/-didChangeValueForKey: you'll get this exception.

What changed in your app? One guess is that nothing was observing any Wine's "wineType.name" before but you're now doing something different with Cocoa Bindings that is causing it to be observed.

				-- Mark

On Apr 14, 2008, at 6:12 PM, Thaddeus Cooper wrote:
Starting earlier today, I started getting the following error in my software.

2008-04-14 17:59:41.535 WineCellar[4928:10b] Cannot remove an observer <WineArrayController 0x25a450> for the key path "wineType.name " from <Wine 0x6c55170>, most likely because the value for the key "wineType" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the Wine class.

I haven't changed anything significant (well at least I don't think I did) and I definitely have not been messing around with the WineArrayController and/or the Wine classes. I can't figure out how to track this error down -- I've tried a number of things including putting a removeObserver:forKeyPath method in the array controller so I could look at the back trace and I've also put in enter and exit debug messages in a large portion of the code. Still the error seems to come from nowhere and I am stumped as to how I might find what the root cause of the problem is.

Does anyone have any suggestions as to how to track down this type of error.

Thanks very much.

Thaddeus O. Cooper
(email@hidden)



_______________________________________________

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

_______________________________________________

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: Cannot Remove Observer Error
      • From: Thaddeus Cooper <email@hidden>
References: 
 >Cannot Remove Observer Error (From: Thaddeus Cooper <email@hidden>)

  • Prev by Date: Re: Using the debugger with local variables was Re: is this badly written code?
  • Next by Date: Re: Using the debugger with local variables was Re: is this badly written code?
  • Previous by thread: Cannot Remove Observer Error
  • Next by thread: Re: Cannot Remove Observer Error
  • Index(es):
    • Date
    • Thread