Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
- Subject: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 9 Jan 2008 09:10:54 +0100
Le 9 janv. 08 à 06:35, Andrew Farmer a écrit :
On 08 Jan 08, at 07:49, parag vibhute wrote:
Thanks for reply. I have a requirement to run the application, not
to show
application icon in dock & to trap shutdown, restart, logout. As
Jean-Daniel
said, there are other ways to capture the logout,restart,shutdown.
But it
seems that those ways are particularly created for daemon otherwise
in cocoa
application, it is rarely that anybody will use those techniques for
capturing logout/restart/shutdown; programmer will use
workspaceWillPowerOff
notification. Those techniques are particularly useful to
differentiate
between logout, restart & shutdown notification. I went through
technote
which you suggested, but for creating daemon, I will need to
implement plist
& I can't do that. I can only make changes in code of my
application. I
can't create plist & stuff like that. I read that in order to
control the
daemon by launchd, do not use "daemon" API. Also checked that if
you launch
the application in C program using system api & concating "&" at
the end of
path (like system "./testapp &"), application runs in background &
its
parent process become launchd. But it doesn't affect. Yes you are
right that
technote mention that do not link daemon to non-daemonized
framework. But I
think that statement is only concerned if you want to relate daemon
to inetd
or launchd etc. Using "daemon" API only in code does not make
application
daemon.
TN2083 makes one thing quite clear: daemon() should not be used in
new applications, and particularly not in any application which uses
the Cocoa or CoreFoundation frameworks.
And that's not an issus, as daemon() is absolutly NOT required to use
SystemConfiguration and IOKit frameworks. All information found in the
previous Q&A can be used in the middle of an Objc Class in a Cocoa
application without problem._______________________________________________
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