Firebase Crashlytics implementation in iOS app

Bipin Pandey
Resume and CV Builder App
4 min readJan 18, 2018

Firebase Crashlytics is a lightweight, realtime crash reporter that helps us to track, prioritize, and fix stability issues that erode your app quality. It alerts when an issue suddenly increases in severity. Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.

Create a Project and App in firebase

Add a new iOS/Android app in the firebase console if you have existing firebase project or create firebase project and create new app in the firebase console.

Add Firebase to iOS App

Firstly in step 1, register your app by adding the bundle identifier while creating iOS app to firebase. In step 2, Download config file GoogleService-Info.plist add it to your workspace like in the image shown below.

In step 3, If you have already initialize your pod file you just need to add pod ‘Firebase/Core’ in your pod file. Else if pod file is not initialize, we need to initialize the pod using $ pod init and then only just need to add pod ‘Firebase/Core’ in your pod file. After adding dependencies to pod file we need to install pod using $ pod install by opening the terminal from our project workspace.

In step 4, We need to configure FirebaseApp by adding FirebaseApp.configure() inside didFinishLaunchOptions method of AppDelegate.swift

Add Crashlytics SDK via CocoaPods

To get started, add the Crashlytics SDK framework files to your project. For most projects, the easiest way to do that is by adding the Crashlytics CocoaPods.

Install dependencies via terminal using pod install.

Test your implementation

Enable Crashlytics debug mode: In order to enable crashlytics in debug mode we need to set Fabric.sharedSDK().debug mode to true in AppDelegate.swift.

Force crash to test implementation: While writing this article, I have one view controller with one button named (Click to crash app) in the middle of the viewController. For the testing purpose, when user click the button app crashed.

Get Deobfuscated crash reports

Firebase Crashlytics automatically processes your debug symbol (.dSYM) files to give you deobfuscated, human-readable crash reports. Unfortunately, there are a few situations when dSYM uploads fail, usually because of unique project configurations or Bitcode in your app. When an upload fails, Crashlytics displays a “Missing dSYM” alert in the Firebase console to let you know that it can’t display crash reports properly.

If you get that alert, there are two things you can try to resolve the issue: check that Xcode is producing the correct dSYM files and, if it is, run the dSYM upload script manually.

Adjust your project’s debug settings

Crashlytics can’t capture crashes if your build attaches a debugger at launch. Adjust your build settings to change the project’s debug information format:

  1. With your project still selected in the Xcode Navigator, open the Build Settings tab.
  2. Click All at the top of the tab to display all build settings.
  3. Search for “debug information format”.
  4. Set the Debug Information Format setting to DWARF with dSYM File.

Test it out

Finally, after the project is setup successfully the console would initially look like.

Now, run your app on the simulator and click on Crash App button to crash the app. In order to see the crash report in the crashlytics section of firebase console.

  1. Click play_arrow Build and then run the current scheme in Xcode to build your app on a device or simulator.
  2. Click stop Stop running the scheme or action in Xcode to close the initial instance of your app. This initial instance includes a debugger that interferes with Crashlytics.
  3. Open your app again from the simulator or device.
  4. Touch Crash to crash the app.
  5. Open your app once more to let the Crashlytics API report the crash. Your crash should show up in the Firebase console within 5 minutes.

Now, click on issue to get more detailed information about the error.

Run the upload symbols script manually

Check out this link to learn the upload symbols script manually.

Please checkout Customizing Crashlytics crash reports official docs from firebase to customize crash report.

--

--