> Date: Fri, 19 Nov 2010 11:58:35 -0800
> From: Laurent Daudelin <laur...@nemesys-soft.com>
> 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._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to