Re: Cocoa daemon
Re: Cocoa daemon
- Subject: Re: Cocoa daemon
- From: Jens Alfke <email@hidden>
- Date: Fri, 1 Aug 2008 12:28:18 -0700
On 1 Aug '08, at 5:17 AM, Ivan C Myrvold wrote:
I try to implement the menu in the NSStatusBar systemStatusBar.
That class is in the AppKit framework. Daemons must not link against
AppKit, or any other framework, like HLTB, that would connect to the
window server. (I believe the big Daemons-and-Agents technote has a
list of what frameworks are OK.)
The reason is that a daemon runs at a lower level of the system than
the window server or a user login session. Daemons should not
generally perform per-user functions because they don't run as a real
user (typically they're either root, or a special-purpose pseudo-user
like 'www'.)
If you want to run a background process on behalf of a particular
login session, use an agent. This is much like writing a daemon except
that you put the launchd plist in ~/Library/LaunchAgents or /Library/
LaunchAgents.
Agents should also ideally not link against AppKit or connect to the
WindowServer; this helps limit the system resources they use. If you
really need to have a UI, such as an NSStatusItem, you should package
your daemon in a .app bundle, using the LSUIElement Info.plist key so
that it won't show up in the Dock.
Again, the technote describes all of this. It's definitely required
reading if you're writing any kind of daemon/agent/background process.
—Jens_______________________________________________
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