如何在运行时期间为iOS禁用Crashlytics? [英] How to disable Crashlytics for iOS during a runtime?

查看:69
本文介绍了如何在运行时期间为iOS禁用Crashlytics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照本教程,我可以将Crashlytics集成到iOS项目中。

Following this tutorial I am able to integrate Crashlytics into an iOS project.

但是,当登录的用户来自我们公司(通过检查已登录用户的电子邮件域)并且仅跟踪我们的客户时,我想禁用跟踪。

However, I would like to disable tracking when users that log in are from our company (by checking email domain for logged user) and only track our clients.

一旦应用运行,是否有可能基于某些条件禁用Crashlytics?我在文档中找不到此选项。

Is it possible to disable Crashlytics based on some conditionals once the app is running? I couldn't find this option in docs.

推荐答案

您无法在运行时禁用它,但是可以防止通过使用中描述的技术发送特定的崩溃报告文档

You can't disable it during a runtime, however, you can prevent it from sending particular crash reports, using technique, described in the documentation:

首先,必须按以下顺序设置 Crashlytics 委托:

First, you must set the Crashlytics delegate in the following order:

CrashlyticsKit.delegate = self;
[Fabric with:@[[Crashlytics class]]];

并实现委托方法:

- (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL))completionHandler {
    // You must set email to CrashlyticsKit, during previous app session, like this:
    // [CrashlyticsKit setUserEmail:userEmail];
    BOOL shouldSendCrashReport = [report.userEmail containsString:@"yourCompanyDomain"];
    completionHandler(shouldSendCrashReport);
}

这篇关于如何在运行时期间为iOS禁用Crashlytics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆