Mag*_*nus 46 cocoa-touch objective-c ios crashlytics twitter-fabric
我找到了一种在Crashlytics Android SDK中记录自定义捕获异常的方法,但我找不到类似iOS SDK的内容.有没有办法在iOS上使用Crashlytics记录捕获的异常?
请参阅Android说明:http://support.crashlytics.com/knowledgebase/articles/202805-logging-caught-exceptions
Mik*_*ell 43
Mike来自Crashlytics和Fabric.
您现在可以在iOS,tvOS或OS X应用程序中捕获已记录的NSErrors.你想用:
[CrashlyticsKit recordError:error];
Run Code Online (Sandbox Code Playgroud)
要么
Crashlytics.sharedInstance().recordError(error)
Run Code Online (Sandbox Code Playgroud)
这将允许您为每个用户会话捕获相当数量的已记录NSErrors.这些仅在应用重新启动时发送.记录的错误错误按错误域和代码分组.这意味着错误问题可以跨越许多不同的呼叫站点.
见文档
最后,Crashlytics添加了所需的功能3.5.0 !!
[CrashlyticsKit recordError:error];
Run Code Online (Sandbox Code Playgroud)
要么
Crashlytics.sharedInstance().recordError(error)
Run Code Online (Sandbox Code Playgroud)
参考
/**
*
* This allows you to record a non-fatal event, described by an NSError object. These events will be grouped and
* displayed similarly to crashes. Keep in mind that this method can be expensive. Also, the total number of
* NSErrors that can be recorded during your app's life-cycle is limited by a fixed-size circular buffer. If the
* buffer is overrun, the oldest data is dropped. Errors are relayed to Crashlytics on a subsequent launch
* of your application.
*
* You can also use the -recordError:withAdditionalUserInfo: to include additional context not represented
* by the NSError instance itself.
*
**/
- (void)recordError:(NSError *)error;
- (void)recordError:(NSError *)error withAdditionalUserInfo:(nullable CLS_GENERIC_NSDICTIONARY(NSString *, id) *)userInfo;
Run Code Online (Sandbox Code Playgroud)
https://docs.fabric.io/ios/changelog.html#january-7-2016
历史
这实际上并不像我预期的那样工作:消息被保存到Crashlytics但只有在应用程序重新启动后它才会保存最后一条消息.
到目前为止,这里提到的解决方案都没有.使用Crashlytics无法在iOS中跟踪处理的异常.
您可以使用它来记录任何异常
[[Crashlytics sharedInstance] recordCustomExceptionName:@"HandledException" reason:@"Some reason" frameArray:@[]];
Run Code Online (Sandbox Code Playgroud)
在Crashlytics中,你会在崩溃报告中看到它但是有NON-FATALS类型.
事件,如果它不是它的预期用法异常以与Android处理的异常相同的方式记录.
这在3.0.7版中可用.
recordCustomExceptionName:原因:frameArray:
此方法可用于在报表中记录单个异常结构.当您的代码与Lua,C#或Javascript等非本地语言交互时,这尤其有用.此调用可能很昂贵,只能在进程终止前不久使用.此API不用于记录NSException对象.Crashlytics会自动捕获所有可安全报告的NSExceptions.
| 归档时间: |
|
| 查看次数: |
11442 次 |
| 最近记录: |