问题
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.
Is it possible to disable Crashlytics based on some conditionals once the app is running? I couldn't find this option in docs.
回答1:
You can't disable it during a runtime, however, you can prevent it from sending particular crash reports, using technique, described in the documentation:
First, you must set the Crashlytics
delegate in the following order:
CrashlyticsKit.delegate = self;
[Fabric with:@[[Crashlytics class]]];
and implement delegate method:
- (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);
}
来源:https://stackoverflow.com/questions/39390279/how-to-disable-crashlytics-for-ios-during-a-runtime