SWIFT iOS中的崩溃报告

soh*_*ani 8 error-handling exception-handling ios swift

您好我正在开发一个ios应用程序,我想在不使用任何第三方sdk或类的情况下实现崩溃报告我想在我的应用程序崩溃时撰写邮件.我已经实现NSSetUncaughtExceptionHandler(exceptionHandlerPtr)didFinishLaunchingWithOptions ,并添加Objective-C代码为它的处理程序代码在这里我的CrashReporting.h文件中

volatile void exceptionHandler(NSException *exception);
extern NSUncaughtExceptionHandler *exceptionHandlerPtr;
Run Code Online (Sandbox Code Playgroud)

和CrashReporting.m代码:

volatile void exceptionHandler(NSException *exception) {
    // Do stuff

    NSLog(@"App IS cCrAsSHsED %@",exception.description);
    NSLog(@"App IS cCrAsSHsED %@",exception.callStackSymbols);

   // Here i will Compose mail with error description and callStackSymbols.
}
NSUncaughtExceptionHandler *exceptionHandlerPtr = &exceptionHandler;
Run Code Online (Sandbox Code Playgroud)

它工作正常,但无法处理所有类型的错误.我怎样才能做到这一点Fatal ErrorsSignal Errors进入swift我已经在谷歌上搜索过但没有找到对swift有帮助的东西.帮助将是欣赏.对不起,我的英语不好.谢谢.

Rap*_*ael 1

这是没有必要的。在我看来,您只是想查看崩溃报告。苹果已经构建了崩溃报告服务,通常(如果用户没有停用它)会向您提供崩溃报告,以便您可以分析它们。

因此没有必要重新发明轮子。