• 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: Calling -addObserver:forKeyPath:… more than once
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling -addObserver:forKeyPath:… more than once


  • Subject: Re: Calling -addObserver:forKeyPath:… more than once
  • From: Rick Mann <email@hidden>
  • Date: Fri, 26 Aug 2011 12:44:12 -0700

Thanks for verifying.

On Aug 26, 2011, at 7:09 , Heath Borders wrote:

> You must call remove as many times as you call add.  Otherwise,
> subclasses and superclasses would interfere with each other's
> observations.
>
> -Heath Borders
> email@hidden
> Twitter: heathborders
> http://heath-tech.blogspot.com
>
>
>
> On Fri, Aug 26, 2011 at 4:34 AM, Rick Mann <email@hidden> wrote:
>> Is -addObserver:forKeyPath:… idempotent? I called it multiple times with the same parameters, but called -removeObserver:forKeyPath: only once, and the object continued to receive KVO notifications.
>>
>> After adding code to ensure -addObserver:forKeyPath:… was only called once, -removeObserver:forKeyPath: seemed to work as expected.
>>
>> I couldn't find any clear indication in the docs or searching online, although I did find some things that indicate these APIs rather do suck.
>>
>> --
>> Rick
>>
>> _______________________________________________
>>
>> 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
>>
> _______________________________________________
>
> 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

_______________________________________________

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: 
 >Calling -addObserver:forKeyPath:… more than once (From: Rick Mann <email@hidden>)
 >Re: Calling -addObserver:forKeyPath:… more than once (From: Heath Borders <email@hidden>)

  • Prev by Date: Re: Calling -addObserver:forKeyPath:… more than once
  • Next by Date: Re: Sharing a persistent store between iOS and Mac
  • Previous by thread: Re: Calling -addObserver:forKeyPath:… more than once
  • Next by thread: Re: Text rendered in NSImage is fuzzy
  • Index(es):
    • Date
    • Thread