How do I create a Cocoa app that runs in the background (not in the dock, and not in the menu bar either; just in 开发者_高级运维the background).
Does the app need admin privileges? I hope not. Actually it shouldn't, because it's enough that the app runs in the background for that user only, i.e. not for all users.
And I guess I can make it "launch when log-in" by just adding it to the user's Account Preferences, so that shouldn't be a problem.
In your Info.plist set LSBackgroundOnly to 1.
In your Info.plist, set LSUIElement to the string “1”.
The main difference is that a UI-element agent can have a UI (order in a window). A background-only app should be completely faceless; whatever UI it has should exist in a separate application or preference pane.
精彩评论