• 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: NSNotificationCenter removeObserver NOT working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter removeObserver NOT working


  • Subject: Re: NSNotificationCenter removeObserver NOT working
  • From: "Michael Ash" <email@hidden>
  • Date: Thu, 4 Sep 2008 16:38:51 -0400

On Thu, Sep 4, 2008 at 5:51 AM, Valentin Dan <email@hidden> wrote:
> I'm trying to remove all notifications that have a certain object and I
> can't seem to get that to work. I'm doing something like this:
>
> [[NSNotificationCenter defaultCenter] removeObserver:nil name:nil
> object:myObject];
>
> The notifications for this sender keep coming and that causes a problem.
> How can I fix that ?

A good general guideline for NSNotificationCenter methods: if you
aren't passing 'self' as the "observer" parameter, you're probably
doing something wrong. Management of observation should be done by the
observers and not by anything else.

There may be situations where this is not the case, but if there are
then I have yet to encounter one in my years of working on OS X.

Mike
_______________________________________________

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: 
 >NSNotificationCenter removeObserver NOT working (From: "Valentin Dan" <email@hidden>)

  • Prev by Date: Re: line break in Interface Builder
  • Next by Date: Re: Disabled NSButton
  • Previous by thread: RE: NSNotificationCenter removeObserver NOT working
  • Next by thread: NSPanel: resigning key focus?
  • Index(es):
    • Date
    • Thread