Re: Not Receiving Distributed Notifications Unless in Focus
Re: Not Receiving Distributed Notifications Unless in Focus
- Subject: Re: Not Receiving Distributed Notifications Unless in Focus
- From: Ken Thomases <email@hidden>
- Date: Mon, 22 Aug 2011 18:44:01 -0500
On Aug 22, 2011, at 5:05 PM, Ian was here wrote:
> I have a suite of apps that send distributed notifications to each other. I have two apps in particular:
>
> 1) App A will launch app B.
> 2) App B will then send a distributed notification to app A when it has finished with its initialization.
> 3) App A can then proceed.
>
>
> In Mac OS X 10.4, 10.5, and 10.6, this behavior is as expected. However, in OS X 10.7.1 it is not. The following scenario occurs:
>
> 1) App A will launch app B.
> 2) App B will then send a distributed notification to app A when it has finished with its initialization.
> 3) App A will do nothing until it comes into focus. Only then will the method receiving the notification be called.
>
> I read the 10.7 documentation and there are permission differences, but the permission settings on the apps themselves are still the same as on the 10.6 Mac. I Googled this as well and no one else seems to have had this issue.
>
> Does anyone know what's going on here? Why can't an app receive a distributed notification if it does not have focus?
See the documentation for -[NSDistributedNotificationCenter setSuspended:] about the fact that NSApplication automatically suspends notification delivery and this note in the Lion Foundation release notes <http://developer.apple.com/library/mac/#releasenotes/Cocoa/Foundation.html>:
> Distributed notification delivery
>
> If you want a posted distributed notification to be received immediately, be sure you are passing the NSNotificationSuspensionBehaviorDeliverImmediately suspension behavior flag when registering for the notification, or using the NSNotificationDeliverImmediately flag when posting. Bugs in Mac OS X releases prior to 10.7 meant that sometimes a distributed notification would get delivered through to suspended observers, and not be properly queued, even when those flags weren't used.
Regards,
Ken
_______________________________________________
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