1

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

Toto
  • 593
  • 7
  • 20

6 Answers6

2

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!
Keshu R.
  • 5,045
  • 1
  • 18
  • 38
2

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

Jun Josky
  • 21
  • 2
1

For new SDK

import FirebaseCrashlytics


fatalError()
Ucdemir
  • 2,852
  • 2
  • 26
  • 44
  • 1
    I have written same but I haven't seen a crash in crashlytics dashboard. Can you tell me why this happened to me. – Mahesh NFC May 13 '20 at 05:07
  • 1
    https://firebase.google.com/docs/crashlytics/test-implementation#test_it_out in this url There is trick... Look at "Test it out" section with five rule section – Ucdemir May 13 '20 at 12:08
  • 1
    I have followed those five rules and i found Upload missing required dSYMs error. I have tried this [link](https://stackoverflow.com/a/61047863/12119646) but still the same. – Mahesh NFC May 13 '20 at 12:28
  • 1
    Upload missing dysm means that Firebase Crashlytic work perfect and your crash report there but you need to upload missing dysm .. Firstly open terminal go to your project pod file and then go to FirebaseCrashlytics folder there is "upload-symbols" drag drop to terminal. Then go to where is located "GoogleService-Info.plist" again darg and drop then go to dsym again darg and drop as a result use this command /path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs Note that you shhould upload dsym uid with given crash – Ucdemir May 13 '20 at 14:25
  • 1
    here is a link https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports .. If your dsym is release you can download from app store – Ucdemir May 13 '20 at 14:27
1

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)
Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
elderio
  • 31
  • 3
  • This is the only thing that worked for me after trying everything else out there—for some reason, I didn't have the `FirebaseCrashlyticsCollectionEnabled` key in my plist at all. I added Crashlytics some time after I'd started using Firebase; not sure if that had anything to do with it. – Evan R Aug 30 '20 at 07:02
0

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

This code is working in my case.

Crashlytics.sharedInstance().crash()
Vasucd
  • 357
  • 2
  • 10
0

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

Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143