简体   繁体   中英

How to create a background-running Cocoa application?

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 , ie 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.

在Info.plist中将LSBackgroundOnly设置为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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM