简体   繁体   中英

How to disable Crashlytics for iOS during development?

Is there any way to disable crash reporting for Ad-Hoc builds? I only want crash reporting for release builds.

I know I can use following code but it only work debug builds.

#if DEBUG == 0
    [Fabric with:@[CrashlyticsKit]];
#endif

Im using Fabric 1.1.3

Edit: I don't want to disable Fabric at all, I just need automatic configurations for Ad-Hoc and Release builds.

I think you can try this :

#ifndef DEBUG
 [Fabric with:@[CrashlyticsKit]];
#endif

If you use Swift, this woud work:

#if !DEBUG
    Fabric.with([Crashlytics.self])
#endif

Development builds are also DEBUG builds, You are probably meaning Ad-Hoc builds. Since the release and Ad-Hoc build use the same configuration you will not be able to tell them apart.

You bets option is to create a new configuration for the AppStore. For this configuration add a Preprocessor Macro , Like FABRIC=1

Then in you build code:

#ifdef FABRIC
    [Fabric with:@[CrashlyticsKit]];
#endif

For Swift, Add this key to plist and set it 'NO'.

firebase_crashlytics_collection_enabled

After this, based on user-defined variable in Build Settings, you can configure this.

#if Development
print("Debug 1")
Fabric.sharedSDK().debug = true
#else
print("Debug 0")
Fabric.with([Crashlytics.self])
#endif

To disable firebase crashlytics for debug mode in swift:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM