Check out what’s new from Firebase@ Google I/O 2021, and join our alpha program for early access to the new Remote Config personalization feature. Learn more

Get started with Firebase Crashlytics

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

Before you begin

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

  2. Recommended: To get features like crash-free users, breadcrumb logs, and velocity alerts, 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: 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 Enable Crashlytics.

Step 2: Add the Firebase Crashlytics SDK to your app

  1. Open the podfile you created for your Firebase project and add the FirebaseCrashlytics pod.

    For an optimal experience with Crashlytics, we recommend enabling Google Analytics in your Firebase project and adding the Firebase pod for Google Analytics to your app.

    pod 'Firebase/Crashlytics'
    
    # Recommended: Add the Firebase pod for Google Analytics
    pod 'Firebase/Analytics'
    
  2. Install the pods, then re-open your .xcworkspace file to see the project in Xcode:

    pod install
    open your-project.xcworkspace
    
  3. Import the Firebase module in your UIApplicationDelegate:

    Swift

    import Firebase

    Objective-C

    @import Firebase;
  4. Configure a FirebaseApp shared instance, typically in your app'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];
      
  5. Recompile your app.

Step 3: Initialize Crashlytics

You can initialize Crashlytics by adding a run script to your project’s build phase. The run script allows Xcode to automatically upload your project’s dSYM file whenever your app crashes so that Crashlytics can automatically generate crash reports.

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

  2. From the Select a project or target dropdown, select your main build target.

  3. Select the Build Phases tab, then click > New Run Script Phase.

  4. Expand the new Run Script section that appears. In the script field (located under the Shell field), add a new run script:

    "${PODS_ROOT}/FirebaseCrashlytics/run"
  5. Add your app’s dSYM location as an input file that enables Crashlytics to automatically generate dSYMs for large apps more quickly. For example:

    ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
    

    You can also provide 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: Run your project

Finally, run your app. Your device logs display the Firebase verification that initialization is complete.

Step 5: 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.

For details about how to do this, visit Test your implementation.

Next steps