On Jun 8, 2011, at 10:11 AM, Leonardo wrote:

>    - launch my app as hidden at a given time (I have a list of timers)
>    - do a task
>    - quit

I suggest using launchd to schedule tasks to run at specific times. (Similar 
functionality to ‘cron’ on traditional Unix.) Then your app doesn’t have to be 
running at all. You’ll need to build a separate binary, for launchd to invoke, 
that runs without a UI; this can be built like a regular command-line tool, so 
you invoke your code from the main() function, don’t link against AppKit, etc.

To schedule the tasks, in a nutshell, you create a plist file for 
configuration, copy it into ~/Library/LaunchAgents/, and use NSTask to invoke 
‘launchctl’ to register the plist.

For more info see:
man 1 launchctl
man 5 launchd.plist
and there’s a long technote by Apple on daemons and agents.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to