Removing Observers
Removing Observers
- Subject: Removing Observers
- From: Ryan Brown <email@hidden>
- Date: Mon, 18 Aug 2008 14:23:38 -0400
What is the best way to remove a KVO observer if you aren't sure if
the object already has an observer registered? Currently I'm catching
the exception raised for an unregistered observer using something like:
@try { [object removeObserver:observerObject forKeyPath:keyPath]; }
@catch(NSException *exception) {}
This seems like a fairly kludgey way to do it though, and apparently
the exception isn't raised on 10.4 (it instead either crashes or does
nothing).
Best,
Ryan
_______________________________________________
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