Firebase Crashlytics 调试模式未在 ios 中发送报告

Firebase Crashlytics debug mode not send report in ios

在swift中,如何仅发送崩溃报告发布模式?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

#if DEBUG
    Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(false)
#endif

    return true
}

对吗? (https://firebase.google.com/docs/crashlytics/customize-crash-reports)

将此添加到 AppDelegate 中的 didFinishLaunchingWithOptions 方法。

    #if DEBUG
    Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(false)
    Crashlytics.crashlytics().checkForUnsentReports { isUnsendExists in
        if isUnsendExists {
            Crashlytics.crashlytics().deleteUnsentReports()
        }
    }
    #else
    Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)
    #endif