【问题标题】:Crash Reporting in SWIFT iOSSWIFT iOS 中的崩溃报告
【发布时间】:2016-03-25 03:02:39
【问题描述】:

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

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

和 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;

它工作正常,但不能处理所有类型错误。我怎么能对Fatal ErrorsSignal Errors 做同样的事情,我在谷歌上搜索过,但没有发现对 swift 有帮助。帮助将不胜感激。对不起,我的英语不好。谢谢。

【问题讨论】:

  • 那些导致app处于不稳定状态的错误无法通过ios app上报。

标签: ios swift error-handling exception-handling


【解决方案1】:

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

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

【讨论】:

  • 我知道这一点。你误会我了。当应用程序崩溃时,我希望通过编程方式进行崩溃描述。
  • 嗯,是的,但你为什么要这样?我之所以这么问,是因为我认为这将有助于了解您试图以不同于 Apple 崩溃报告者的方式解决的具体问题。
猜你喜欢
  • 2015-04-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多