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: Andrew Farmer <email@hidden>
- Date: Tue, 8 Jan 2008 01:25:22 -0800
On 08 Jan 08, at 00:11, parag vibhute wrote:
Is anybody there?
Please reply.
No, there is nobody here. Our activity on this mailing list is a
massive hoax.
Seriously, though:
On 1/5/08, parag vibhute <email@hidden> wrote:
While going through code snippets given in QA, I observed that apple
used *
daemon* API to run process in background. In my cocoa application, I
just
added daemon(0,0) line in my main function & using LSUIElement, hide
the
application icon. Now even though dock icon is hidden, my
application is
able to trap logout/restart/shutdown in
-(void)workspaceWillPowerOff:(NSNotification
*)aNotification. Want to know whether this way is correct? or is it
having
any drawback?
It has some significant drawbacks. Read Tech Note 2083 [1]. In
particular, daemon() is deprecated under Mac OS 10.5, and a number of
frameworks (including Core Foundation!) are unsafe to call from a
daemon (forked-without-exec) context.
[1]: http://developer.apple.com/technotes/tn2005/tn2083.html
_______________________________________________
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