问题描述
我已将 Crashlytics
安装到我的应用程序中,它工作正常,并将崩溃报告发送到服务器。
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.
因此,如果用户在设置页面中关闭开关
,则应阻止
Crashlytics
报告被发送到其服务器。
So if the user toggle off the switch
in setting page, It should block
the Crashlytics
report from being send to its server.
但是我没有看到任何选项 Crashlytics
框架来阻止报告,甚至阻止 Crashlytics
的运行。
But i'm not seeing any option in the Crashlytics
framework to block the reports or even stop the Crashlytics
from running.
有什么办法阻止报告或阻止Crashlytics
运行?
推荐答案
更改设置后,可以确保在应用重新启动后未启用Crashlytics。在应用程序委托中,您可以检查设置,然后启用Crashlytics。
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]]];
}
}
这篇关于iOS Crashlytics-阻止崩溃报告发送到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!