Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force a crash in Swift iOS app with Fabric SDK?

All I can find is Is there a quick way to force a crash? which says to:

[[Crashlytics sharedInstance] crash];

which I think in Swift would be

Crashlytics.sharedInstance.crash()

but this does not seem to exist. (perhaps the docs are out of date and no longer apply since Fabric gobbled up Crashlytics?)

I see that there is a Crashlytics.crash(self:Crashlytics) ...nevermind, friggin XCode's completion is always broken for me. See answer below.

like image 497
Michael Avatar asked Jan 20 '15 19:01

Michael


1 Answers

If you are using the new Firebase Crashlytics SDK note that import Crashlytics has been replaced by import FirebaseCrashlytics. The crash() method is no longer available in the new SDK. As recommended by Firebase, simply use:

Swift:

fatalError()

Obj C:

assert(NO);
like image 133
FFFF0H Avatar answered Oct 07 '22 02:10

FFFF0H