Gå til konsol

Get started with Firebase Crashlytics

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

Before you begin

Before you can set up Crashlytics, you need to register your iOS app and configure it to use Firebase.

  • If your iOS app already uses Firebase, then it's already registered and configured for Firebase.

  • If you don't have an iOS app, you can download a sample app.

    Note that adding Firebase to your iOS app involves tasks both in the Firebase console and in your open Xcode project (for example, you download Firebase config files from the console, then move them into your Xcode project).

Step 1: Set up Crashlytics in the Firebase console

  1. Click Crashlytics in the left-hand nav panel of the Firebase console.

  2. If your Firebase project has multiple apps registered in it, select the app you just added from the dropdown next to Crashlytics in the top bar of the console.

  3. Click Set up Crashlytics.

  4. Select This app is new to Crashlytics (it doesn't have any version of the SDK).

Step 2: Add the Crashlytics SDK

To get started, add the Crashlytics SDK framework files to your project's Xcode workspace. For most projects, the easiest way to do that is by adding the Crashlytics CocoaPods. However, if your project can't support CocoaPods, you can also add the files manually.

Step 3: Initialize Crashlytics

The frameworks you added include a run script that initializes Crashlytics. Add it to your project's build phases:

  1. Open your project in Xcode, then select its project file in the Navigator.

  2. Select your main build target from the Select a project or target dropdown.

  3. Open the target's Build Phases tab.

  4. Click + Add a new build phase, then select New Run Script Phase.

  5. Add the following line to the Type a script text box:

    CocoaPods install
    "${PODS_ROOT}/Fabric/run"
    Manual install
    "${PROJECT_DIR}/Fabric.framework/run"

  6. Xcode 10 only: Add your app's built Info.plist location to the Build Phase's Input Files field:

    $(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

    After you add the SDK to your app, Crashlytics automatically gets to work listening for and collecting crash reports.

Step 4: Build or run your project

Run your app to send verification to Firebase that you've successfully integrated Firebase.

Your device logs will display the Firebase verification that initialization is complete.

Watch a video tutorial

For detailed guidance on getting started with Crashlytics, watch the following video tutorial:

You can find more videos on the Firebase YouTube channel.

Next steps

  • Test your implementation— Test your Crashlytics setup by forcing a crash to generate a crash report in the Firebase console.

  • Customize crash reports— Crashlytics automatically starts collecting crash reports as soon as you add the SDK, but you can also customize your setup by adding opt-in reporting, logs, keys, and even tracking of non-fatal errors.