Re: How to test if object is KVO observer?
Re: How to test if object is KVO observer?
- Subject: Re: How to test if object is KVO observer?
- From: Andreas Eriksson <email@hidden>
- Date: Thu, 16 Apr 2009 08:35:20 +0200
On Wed, Apr 15, 2009 at 10:09 PM, I. Savant <email@hidden>wrote:
> On Wed, Apr 15, 2009 at 3:51 PM, Andreas Eriksson <email@hidden>
> wrote:
> > Is there a way to test if an object is a KVO observer of a different
> object?
> > Something like -[a isObserving:b forKeyPath:@"akeypath"]?
>
> The easy answer: Look up NSKeyValueObserving protocol's
> -observationInfo and check against that.
Thanks, I'll do that.
The not-so-easy answer: it depends on what you're trying to
> accomplish. Why are you interested in this information? This is one of
> those questions that make me think there may be a better approach to
> what you're trying to do. I may be wrong. :-)
Only for unit testing. I had a case where I failed to remove an observer
and I want to add a test for it.
_______________________________________________
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