• 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: Using NSTerminateLater with a Status Item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSTerminateLater with a Status Item


  • Subject: Re: Using NSTerminateLater with a Status Item
  • From: "Olivier Lance" <email@hidden>
  • Date: Mon, 14 Feb 2011 20:29:29 +0100
  • Thread-topic: Using NSTerminateLater with a Status Item

Hi Jeff,

Well that's what I was afraid to learn...
Gotta find a workaround then!

Do you know if by any chance, something similar can be done from a process running as a service using launchd?

Thanks a lot for you quick reply :)
Olivier

Le 14 févr. 2011 à 19:06, "Jeff Johnson" <email@hidden> a écrit :

> Hi Olivier.
>
> rdar://problem/6001460
>
> See http://lapcatsoftware.com/rdar/6001460/index.html for an explanation.
>
> In short, you won't be able to do it with a LSUIElement app.
>
> -Jeff
>
>
> On Feb 14, 2011, at 10:52 AM, Olivier Lance wrote:
>
>> Hi all,
>>
>> I'm facing a problem returning NSTerminateLater from applicationShouldTerminate: in a status item application...
>> I've tried many things and followed the doc I've found, but nothing works as I'm expecting it to.
>>
>> In short, I want to delay the termination of my status item application (which has LSUIElement set to YES if that matters) so that I can clean some things up before exiting.
>>
>> It does work when I quit the application manually from the menu, but not at all when I'm restarting the computer. I've seen Terminal and other apps block the restart process to ask the user to confirm termination, so I guess what I want is feasible. I'm just probably missing some details...
>>
>> Here's what I do :
>>
>> in applicationShouldTerminate: I display a dialog using NSRunPanel. Depending on user choice, I either return NSTerminateNow or NSTerminateLater.
>> When I return NSTerminateLater I initiate my clean up process, which makes some asynchronous calls to a device driver. When I receive the driver's response, I call [NSApp replyToApplicationShouldTerminate:YES].
>> The entire process works perfectly fine when the app is being exited from the status item menu. If I do " > Restart" though, the AlertPanel shows (sometimes it doesn't even have the time to show up) but the system continues exiting and I don't have time to click anything.
>>
>> I've tried always returning NSTerminateLater, and then display the Alter Panel, but it doesn't change anything.
>>
>> So what am I doing wrong? Is there a requirement I don't meet? Does it have to be a document-based application?
>>
>> Also, would you have any clever way to debug that kind of situation? Tried remote debugging but the connection would just be shut on restart...
>>
>> Thanks a lot,
>> Olivier Lance._______________________________________________
>
_______________________________________________

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: Using NSTerminateLater with a Status Item
      • From: "email@hidden" <email@hidden>
References: 
 >Using NSTerminateLater with a Status Item (From: Olivier Lance <email@hidden>)
 >Re: Using NSTerminateLater with a Status Item (From: Jeff Johnson <email@hidden>)

  • Prev by Date: Re: NSTableView auto sorting does not work
  • Next by Date: Re: UINavigationController in Popover
  • Previous by thread: Re: Using NSTerminateLater with a Status Item
  • Next by thread: Re: Using NSTerminateLater with a Status Item
  • Index(es):
    • Date
    • Thread