简体   繁体   English

SWIFT iOS中的崩溃报告

[英]Crash Reporting in SWIFT iOS

Hello i am developing one ios application where i want to implement crashing reporting without using of any third party sdk or class i want to compose mail when my app will crash. 您好,我正在开发一个ios应用程序,该应用程序要在我的应用程序崩溃时不使用任何我要撰写邮件的第三方sdk或类来实现崩溃报告。 I have implemented NSSetUncaughtExceptionHandler(exceptionHandlerPtr) into didFinishLaunchingWithOptions and added Objective-C Code for its handler Here Code of my CrashReporting .h file 我已经将NSSetUncaughtExceptionHandler(exceptionHandlerPtr)didFinishLaunchingWithOptions并为其处理程序添加了Objective-C代码这里是我的CrashReporting .h文件的代码

volatile void exceptionHandler(NSException *exception);
extern NSUncaughtExceptionHandler *exceptionHandlerPtr;

and CrashReporting.m Code: 和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;

Its works fine but its not able to handle all type errors. 它可以正常工作,但不能处理所有类型错误。 how can i do same for Fatal Errors and Signal Errors into swift i have searched on Google but nothing found helpful for swift. 我已经在Google上搜索了Fatal ErrorsSignal Errors我该怎么做,却没有发现有助于迅速解决。 Help will be Appreciate. 帮助将不胜感激。 Sorry for my bad english. 对不起,我的英语不好。 Thanks. 谢谢。

This is not necessary. 这不是必需的。 It sounds to me that you just want to see the crash reports. 在我看来,您只想查看崩溃报告。 Apple has already built the Crash Report Service which will usually (if users did not deactivate it) deliver you the crash reports so you can analyze them. Apple已经构建了崩溃报告服务 ,该服务通常会(如果用户未停用它)向您提供崩溃报告,以便您进行分析。

Therefore it is not necessary to reinvent the wheel. 因此,没有必要重新发明轮子。

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

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