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 Errors并Signal Errors进入swift我已经在谷歌上搜索过但没有找到对swift有帮助的东西.帮助将是欣赏.对不起,我的英语不好.谢谢.
| 归档时间: |
|
| 查看次数: |
1551 次 |
| 最近记录: |