Re: [BUG?] LSUIElement=YES and NSWorkspaceDidTerminateApplicationNotification
Re: [BUG?] LSUIElement=YES and NSWorkspaceDidTerminateApplicationNotification
- Subject: Re: [BUG?] LSUIElement=YES and NSWorkspaceDidTerminateApplicationNotification
- From: Peter Ammon <email@hidden>
- Date: Wed, 31 Jul 2013 12:47:07 -0700
On Jul 31, 2013, at 9:28 AM, Jerry Krinock <email@hidden> wrote:
>
> On 2013 Jul 31, at 06:32, Stephane Sudre <email@hidden> wrote:
>
>> Is it a known bug that the NSWorkspaceDidTerminateApplicationNotification notification is not
>> sent for applications whose LSUIElement key is set to YES?
>
> The *behavior* is known, at least by me, and is as you say, Stephane. The question is: Does Apple consider it to be a bug?
>
> The documentation of NSWorkspaceDidTerminateApplicationNotification states that it is "posted when an application finishes executing". Is an application running with LSUIElement considered to be an "application"? Unfortunately, NSWorkspace documentation throws out the word "application" like that in quite a few places without a precise definition.
>
> This is likely one of those cases where it would be safe to assume that Apple will not change ("fix") the behavior, because to do so might break apps expecting the old behavior.
>
> Have you filed a bug on this and has there been any response? If not, I'll file one because I too use this notification and would at least like the behavior to be properly documented.
Yes, NSWorkspace does not post DidTerminate notifications (and a few others) for background and UIElement apps. This is one of those historical quirks that must be maintained for bug compatibility.
The more modern -[NSWorkspace runningApplications] method gives you a list of all applications, including background and UIElement. You can use KVO to observe this property, and be notified when apps are launched or terminated.
Hope that helps!
_______________________________________________
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