Re: removeObserver:forKeyPath: when already removed
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