• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to test if object is KVO observer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >How to test if object is KVO observer? (From: Andreas Eriksson <email@hidden>)
 >Re: How to test if object is KVO observer? (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: How to control the window by cocoa
  • Next by Date: Re: Combing Bindings with Target-Action
  • Previous by thread: Re: How to test if object is KVO observer?
  • Next by thread: 3 iPhone SDK Questions
  • Index(es):
    • Date
    • Thread