0

Here incase of android firebase crash can be implemented in APPLICATION class like.. below example

(...here, if android app is crashed this overrriden method uncaughtException(Thread thread, Throwable e) is called where we report crash to firebase...)

So, I want to know if there is any better way to implement firebase crash in iOS swift 3 like this.

/** onCreate method of MainApplication.java */
@Override
public void onCreate() {
    super.onCreate();
    reportFirebaseCrash();
}

/** Report FirebaseCrash Exception if application crashed */
private void reportFirebaseCrash() {

        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable e) {
                AppUtils.showLog(TAG, "reportFirebaseCrash");
                FirebaseCrash.report(e);
        }
    });

}
AL.
  • 36,815
  • 10
  • 142
  • 281
jazzbpn
  • 6,441
  • 16
  • 63
  • 99

1 Answers1

0

Highly recommend you check out the Firebase docs — they're quite well done and should give you all the help you need to get started.

In particular, the simplest way to get up and running is to use the crash reporting pod:

pod 'Firebase/Crash'

Then you need to configure a FIRApp shared instance. Once that's set up (or if you have already), you need to configure your build system to upload crash reports. The docs link includes all the necessary details to do it, but tl;dr, you need to create a new Run Script build phase:

# Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist file
GOOGLE_APP_ID=1:my:app:id

# Replace the /Path/To/ServiceAccount.json with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "/Path/To/ServiceAccount.json"

Firebase also supports Bitcode in order to gather crash data from production users.

brandonscript
  • 68,675
  • 32
  • 163
  • 220