iOS Crashlytics - Block crash reports from being send to server

血红的双手。 提交于 2020-02-08 09:35:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!