Toto
Toto

Reputation: 613

Firebase/Crashlytics Version 4.0.0-beta.1 - ForceCrash?

How do you force a crash on the new version of Firebase Crashlytics 4.0.0-beta.1?

I have tried to crash the app with fatalError(), but the Crashlytics doesn't record the crash in Dashboard.

Also tried to unplug my device, run the app and force crash with fatalError() but still no report in Dashboard.

Also tried Crashlytics.sharedInstance().crash(), but getting error message Type 'Crashlytics' has no member 'sharedInstance()'.

Any ideas? Thank you

Upvotes: 1

Views: 2082

Answers (6)

Michał Ziobro
Michał Ziobro

Reputation: 11752

Firebase (Google) recommends to use just

// Force a test crash
fatalError()

Old API was deprecated and there is no more crash() method or throwException()

Check this https://firebase.google.com/docs/crashlytics/upgrade-sdk

Upvotes: 0

elderio
elderio

Reputation: 31

Take a look into your Info.plist, rename the following key and set it TRUE

firebase_crashlytics_collection_enabled -> FirebaseCrashlyticsCollectionEnabled

Or you can also try this

Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)

Upvotes: 1

Ucdemir
Ucdemir

Reputation: 3098

For new SDK

import FirebaseCrashlytics


fatalError()

Upvotes: 1

Jun Josky
Jun Josky

Reputation: 21

You can use fatalError() instead of Crashlytics.sharedInstance().crash()

Upvotes: 2

Vasucd
Vasucd

Reputation: 357

Use pod version in your file pod 'Crashlytics', '~> 3.14.0' .

This code is working in my case.

Crashlytics.sharedInstance().crash()

Upvotes: 0

Keshu R.
Keshu R.

Reputation: 5215

As the documentation says, use

Crashlytics.sharedInstance().crash()

Crash reports are sent to the server when you start the app again.

Option2: If nothing works, just declare an optional and force unwrap it. :) CRASH

var v : Int!

// then in your viewDidLoad() or in button action
let a = v!

Upvotes: 2

Related Questions