如何创建一个后台运行的Cocoa应用程序? [英] How to create a background-running Cocoa application?
本文介绍了如何创建一个后台运行的Cocoa应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建一个在后台运行的Cocoa应用程序(不是在Dock中,而是在菜单栏中,只是在后台)。
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.
推荐答案
在您的Info.plist中设置 LSBackgroundOnly 至1。
In your Info.plist set LSBackgroundOnly to 1.
这篇关于如何创建一个后台运行的Cocoa应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文