我怎样才能让Crashlytics在我的应用不崩溃的情况下接收日志?我有以下代码:
if(!context.managedObjectContext save:&error) {
CLS_LOG(@"%@",error.description)
}当发生错误时,我希望Crashlytics服务器收到错误,但应用程序应该继续运行。
我现在不需要日志。我很乐意在下一次重启时获得日志。我只是不想在我的应用程序中触发崩溃来接收日志。
这个是可能的吗?
发布于 2016-01-26 02:07:51
使用crashlytics的新更新,您现在可以使用:
[[FIRCrashlytics crashlytics] recordError:error];在Swift中:
Crashlytics.crashlytics().record(error: error)您可以查看文档here。
发布于 2015-11-30 22:58:15
发布于 2015-05-12 15:34:29
我尝试了下面的几行代码,它很有魅力。在try-catch块中,在catch块中使用以下代码行
@try {
// line of code here
}
@catch (NSException *exception) {
NSUncaughtExceptionHandler *handler = NSGetUncaughtExceptionHandler();
handler(exception);
}正如在http://support.crashlytics.com/knowledgebase/articles/222764-can-i-use-a-custom-exception-handler上解释的那样
更新
现在,在fabric的crashlytics中,我们可以使用简单的函数[Crashlytics recordCustomExceptionName:reason:frameArray:]来发送已处理的异常
@try {
// line of code here
}
@catch (NSException *exception) {
NSArray *stack = [exception callStackReturnAddresses];
[[Crashlytics sharedInstance] recordCustomExceptionName: exception.name
reason: exception.reason
frameArray: stack];
}https://stackoverflow.com/questions/24950777
复制相似问题