触发器“应用程序意外退出”当OS X deamon崩溃时弹出 [英] Trigger "application quit unexpectedly" popup when OS X deamon crashes

查看:186
本文介绍了触发器“应用程序意外退出”当OS X deamon崩溃时弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个新的OS-X守护程序进程(从launchd运行),并希望在每次遇到所有相关信息(pid,崩溃文件路径等)时弹出窗口。这将有助于我在开发初期的调试工作。



基本上,我想要具有与UI应用程序相同的行为。例如:



我已经做了一些研究,发现了CrashReporter,但是我不知道如何注册我的应用程序到这个服务。但是,似乎没有办法从此服务触发弹出窗口,因为崩溃是系统级事件,应用程序与这些服务没有任何互动。



也许有一种方法所以通过在应用程序包中或通过Info.plist设置一些参数?



编辑:查看崩溃报告手册,看起来意外的对话框只能在GUI用户模式,而不是从launchd运行的守护程序。也许我错过了什么?


此外,如果崩溃的程序作为登录的GUI用户运行,CrashReporter将向用户呈现一个对话框,询问他们是否他们想向苹果提交错误报告(见图1)。如果用户单击报告按钮,CrashReporter显示另一个对话框,显示报告的详细信息(参见图2),并允许用户在提交报告之前对其进行评论。


我已经阅读了除了应用程序崩溃之外的Developer选项启用,还会为后台和系统进程显示崩溃。但是不幸的是我不适合我。



谢谢

解决方案

似乎出现问题,因为我的后台进程是在root权限下运行的,root权限进程(而不仅仅是守护进程)无法在屏幕上启动任何UI小部件。



我想,处理它的唯一方法是捕捉触发崩溃的信号,并发送在非root模式下运行的代理进程的详细信息并可以启动具有崩溃详细信息的UI对话框。



我很乐意听到更好的提案。


I'm working on a new OS-X Daemon process (run from launchd) and would like to get popup window every time it crashes with all relevant information (pid, path to crash file, etc...). This will sure help my debugging effort in this early stage of the development.

Basically, i want to have the same behavior as a UI application. For example :

I've made some research and found out about the CrashReporter, but i don't know how to register my app to this service. But it seem like there's no way to trigger popup windows from this service, since crashes are system level events and apps have zero interaction with those.

Maybe there's a way to do so by setting up some parameters in app bundle or via Info.plist ?

EDIT: looking at the crash report manual, it looks like the unexpected dialog works only on GUI user mode, and not on daemon that runs from launchd. perhaps i'm missing something ?

In addition, if the program that crashed is running as a logged in GUI user, CrashReporter will present the user with a dialog asking them whether they want to submit a bug report to Apple (see Figure 1). If the user clicks the Report button, CrashReporter displays another dialog that shows the details of the report (see Figure 2) and allows them to comment it before submission.

I've read that Developer option enable in addition to application crashes, crashes are also displayed for background and system processes. but unfortunately i doesn't work for me.

thanks

解决方案

Seems like the problem occurs since my background process runs under root privilege, and root privilage process (not just daemons) cannot initiate any UI widget on the screen.

I guess that the only way to deal with it, is by catching the signal that trigger the crash, and send details for a proxy process that run on non-root mode and can initiate the UI dialog box with crash details.

I would be happy to hear for better proposals.

这篇关于触发器“应用程序意外退出”当OS X deamon崩溃时弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆