如何在monotouch/ios中捕获所有崩溃异常?

Blu*_*Sky 2 exception xamarin.ios

我已经在main.cs中包装了日志代码以捕获异常,但是通过monotouch构建的app通常会在iPad中崩溃,而我找不到任何日志.(某些代码包含多线程操作和wcf服务)

如何捕获所有崩溃异常?

public class Application
{
    // This is the main entry point of the application.
    static void Main (string[] args)
    {
        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        try
        {
            UIApplication.Main (args, null, "AppDelegate");
        }
        catch (Exception ex)
        {
            Util.LogException("Main",ex);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Rol*_*nge 5

本机崩溃无法转换为托管异常(进程状态无效,因此无法安全继续).

有两种类型的信息可以帮助您(或帮助他人帮助您)弄清楚发生了什么:

  • 崩溃报告.
  • 设备日志.

您可以在Xcode的管理器中找到崩溃报告,并在MonoDevelop的iOS设备日志簿中找到设备日志.以下是如何查找每个的更详细的说明.