On Wed, Apr 15, 2009 at 10:09 PM, I. Savant <[email protected]>wrote:

> On Wed, Apr 15, 2009 at 3:51 PM, Andreas Eriksson <[email protected]>
> 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 protected])

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 [email protected]

Reply via email to