Get started with Firebase Crashlytics


This quickstart describes how to set up Firebase Crashlytics in your app with the Firebase Crashlytics SDK so that you can get comprehensive crash reports in the Firebase console.

Setting up Crashlytics requires tasks both in the Firebase console and your IDE (like adding a Firebase configuration file and the Crashlytics SDK). To finish setup, you'll need to force a test crash to send your first crash report to Firebase.

Before you begin

  1. If you haven't already, add Firebase to your Apple project. If you don't have an Apple app, you can download a sample app.

  2. Recommended: To automatically get breadcrumb logs to understand user actions leading up to a crash, non-fatal, or ANR event, you need to enable Google Analytics in your Firebase project.

    • If your existing Firebase project doesn't have Google Analytics enabled, you can enable Google Analytics from the Integrations tab of your > Project settings in the Firebase console.

    • If you're creating a new Firebase project, enable Google Analytics during the project creation workflow.

Step 1: Add the Crashlytics SDK to your app

Use Swift Package Manager to install and manage Firebase dependencies.

  1. In Xcode, with your app project open, navigate to File > Add Packages.
  2. When prompted, add the Firebase Apple platforms SDK repository:
  3.   https://github.com/firebase/firebase-ios-sdk.git
  4. Choose the Crashlytics library.
  5. To take advantage of breadcrumb logs, also add the Firebase SDK for Google Analytics to your app. Make sure that Google Analytics is enabled in your Firebase project.
  6. Add the -ObjC flag to the Other Linker Flags section of your target's build settings.
  7. (macOS only) In your Info.plist, add the key NSApplicationCrashOnExceptions and set it to YES.
  8. When finished, Xcode will automatically begin resolving and downloading your dependencies in the background.

Next, configure the Firebase module:

  1. Import the Firebase module in your App struct or UIApplicationDelegate:

    Swift

    import Firebase

    Objective-C

    @import Firebase;
  2. Configure a FirebaseApp shared instance, typically in your app delegate's application(_:didFinishLaunchingWithOptions:) method:

    Swift

    // Use the Firebase library to configure APIs.
    FirebaseApp.configure()
    

    Objective-C

    // Use the Firebase library to configure APIs.
    [FIRApp configure];
    

Step 3: Force a test crash to finish setup

To finish setting up Crashlytics and see initial data in the Crashlytics dashboard of the Firebase console, you need to force a test crash.


And that's it! Crashlytics is now monitoring your app for crashes. Visit the Crashlytics dashboard to view and investigate all your reports and statistics.

Next steps

  • Integrate with Google Play so that you can filter your Android app's crash reports by Google Play track directly in the Crashlytics dashboard. This allows you to better focus your dashboard on specific builds.