Zee
Zee

Reputation: 1905

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.

Upvotes: 12

Views: 9332

Answers (5)

Umair Ali
Umair Ali

Reputation: 836

To disable firebase crashlytics for debug mode in swift:

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

Upvotes: 10

ZeroOne
ZeroOne

Reputation: 684

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

Upvotes: 2

Andrey Gordeev
Andrey Gordeev

Reputation: 32499

If you use Swift, this woud work:

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

Upvotes: 5

rckoenes
rckoenes

Reputation: 69489

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

Upvotes: 4

Julien Lacroix
Julien Lacroix

Reputation: 63

I think you can try this :

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

Upvotes: 5

Related Questions