On Wed, Nov 11, 2009 at 2:35 PM, James Walker <jam...@frameforge3d.com> 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?
Yeah this is currently what happens (wasn't always this way IIRC) and I don't think I have ever seen it documented (not that I expect it to be). IMHO I wish it didn't throw an exception since it puts extra work on developers to track if they are currently observing a keypath before attempting to remove that observation. It is nice to have as a debugging aid but it does make some simpler code patterns impossible. -Shawn _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com