• 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 not always working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter not always working?


  • Subject: Re: NSNotificationCenter not always working?
  • From: Laurent Daudelin <email@hidden>
  • Date: Fri, 19 Nov 2010 12:35:29 -0800

On Nov 19, 2010, at 12:16, Matt Neuburg wrote:

>
>> Date: Fri, 19 Nov 2010 11:58:35 -0800
>> From: Laurent Daudelin <email@hidden>
>> Subject: NSNotificationCenter not always working?
>>
>> Is there a way to debug why the same "postNotificationName:object:userInfo:" would not work the second time it's called?
>
> In a word - no. This is one of the worst aspects of NSNotificationCenter; I have complained about it many times, filed bugs, etc., and I suggest you do the same. In particular we need a way to ask the center what's registered with it, and for what.
>
> The last time I had a problem such as you describe, it turned out that my own code, far off in a different file, was unregistering me - so, the second time the notification was posted, I was no longer an observer. This was discovered essentially by simple reading all my code really carefully. In fact, by the time I figured it out, I had actually stopped using notifications in that project, because they were so hard to debug.
>
> I complained about this and did receive an interesting suggestion about breakpoints; but this is not as good as a simple ability to query the notification center would be.
>
> <http://www.cocoabuilder.com/archive/cocoa/157926-how-to-debug-notification-that-never-received.html>
>
> And of course a tiny misspelling in the name of a notification will get you too. This can be largely avoided by using a #define but people are often lazy about that.
>
> m.

Thanks, Matt. I'm of course using defines for my only notification name. I'm suspecting it's my code as well but it's fairly straightforward. I'll revise my code and see what I can do but I was afraid that in the case of NSNotificationCenter, there wasn't much I could do, hence my question. Maybe will override some methods through a protocol to see if some of the steps are working as they should.

If anybody has any insight, suggestions are welcomed.

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://www.nemesys-soft.com/
Logiciels Nemesys Software              				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

  • Follow-Ups:
    • Re: NSNotificationCenter not always working?
      • From: Wayne Packard <email@hidden>
References: 
 >Re: NSNotificationCenter not always working? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: NSNotificationCenter not always working?
  • Next by Date: Little suggestion for many many images app, best approach.
  • Previous by thread: Re: NSNotificationCenter not always working?
  • Next by thread: Re: NSNotificationCenter not always working?
  • Index(es):
    • Date
    • Thread