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 (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