• 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: removeObserver:forKeyPath: when already removed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removeObserver:forKeyPath: when already removed


  • Subject: Re: removeObserver:forKeyPath: when already removed
  • From: Jim Correia <email@hidden>
  • Date: Wed, 11 Nov 2009 18:36:59 -0500

On Nov 11, 2009, at 5:35 PM, James Walker wrote:

> I had a situation where removeObserver:forKeyPath: was called twice for the same receiver (an NSUserDefaultsController), the same observer, and the same key path.  It threw an NSRangeException.  But the KVO docs don't say anything about removeObserver:forKeyPath: throwing an exception.  Should this be considered a documentation bug, or is it a bug that -[NSUserDefaultsController removeObserver:forKeyPath:] threw an exception, or should I have just expected this due to some general principle?

Cocoa reserves the use of exceptions for programming errors an unexpected runtime errors.

Trying to remove an observer for a key path which has already been removed (or never registered) falls into the programming error class, so I wouldn’t expect this to be explicitly documented.

Jim

_______________________________________________

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: removeObserver:forKeyPath: when already removed
      • From: Jerry Krinock <email@hidden>
References: 
 >removeObserver:forKeyPath: when already removed (From: James Walker <email@hidden>)

  • Prev by Date: Re: iPhone CLLocation Accuracy?
  • Next by Date: Re: How many processors do I have?
  • Previous by thread: removeObserver:forKeyPath: when already removed
  • Next by thread: Re: removeObserver:forKeyPath: when already removed
  • Index(es):
    • Date
    • Thread