简体   繁体   English

Mac启动守护程序运行时在重启期间启动时从不调用应用程序委托

[英]Mac launch daemon runtime never calls app delegate when starting during reboot

I'm working on a Mac OS X service that is managed as a launch daemon. 我正在使用作为启动守护程序管理的Mac OS X服务。 It does not have any GUI, but it is structured as a Cocoa app run with NSApplicationMain. 它没有任何GUI,但其结构是与NSApplicationMain一起运行的Cocoa应用程序。

It seems like even though there is no GUI, there is a problem - everything works fine when started via launchctl in a terminal window, but on system reboot while a process is started I've determined that once NSApplicationMain() is called the process gets stuck. 似乎即使没有GUI,也存在问题-通过终端窗口中的launchctl启动时,一切正常,但是在启动进程的系统重启后,我确定一旦调用NSApplicationMain()卡住。 The app delegate method applicationDidFinishLaunching: is never invoked (which is where we initialize the service). 应用程序委托方法applicationDidFinishLaunching:不会被调用(这是我们初始化服务的位置)。 There's also no error logged and NSApplicationMain() does not return. 也没有记录错误,并且NSApplicationMain()不返回。

I've combed through the Launch Services docs but I don't see any mention of this issue, nor have I found any information that says a non-GUI NSApplication runtime requires a login or window server to be present. 我已经浏览了Launch Services文档,但没有看到任何关于此问题的信息,也没有发现任何信息表明非GUI NSApplication运行时要求提供登录名或窗口服务器。

Anyone have experience with this, know a common gotcha or have a definitive answer whether it's possible to have a non-GUI NSApplication-based launchd service start at boot time? 任何有此经验的人,都知道一个共同的难题,或者有明确的答案,是否有可能在引导时启动基于非GUI NSApplication的启动服务?

It looks like this is related to Bootstrap namespace issues and probably falls under this already-asked question (which for some reason did not turn up in results when I searched stackoverflow for related terms) 看来这与Bootstrap命名空间问题有关,并且可能属于这个已经提出的问题(由于某种原因,当我在stackoverflow中搜索相关术语时,结果没有出现)

Drawbacks of building a background-only COCOA app as a launch daemon? 将纯背景的可可应用程序构建为启动守护程序的缺点?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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