Re: NSNotificationCenter removeObserver NOT working
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