问题
I have installed the Crashlytics
to my app, It's working fine and sends crash reports to the server.
But in my app setting
, I'm having new option as "Send crash reports" switch.
So if the user toggle off the switch
in setting page, It should block
the Crashlytics
report from being send to its server.
But i'm not seeing any option in the Crashlytics
framework to block the reports or even stop the Crashlytics
from running.
Is there any way to block the reports or stop the Crashlytics
from running?
回答1:
Once the setting changes, you can make sure Crashlytics is not enabled once the app restarts. In your app delegate, you can check for the setting and then enable Crashlytics.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Crashlytics
//Check setting
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"CanSendCrashReports"])
{
[Fabric with:@[[Crashlytics class]]];
}
}
来源:https://stackoverflow.com/questions/35719683/ios-crashlytics-block-crash-reports-from-being-send-to-server