How to Add Firebase’s Crashlytics to a Xamarin.iOS Project

Recently I’ve been doing some Xamarin development. Today, I had to find a way to add Firebase’s Crashlytics service to a Xamarin.iOS app. Not shockingly, there isn’t a ton of clear and succinct information on how to do this, so hopefully this post helps you.

1. Install NuGet packages.

Install the Xamarin.Firebase.iOS.Crashlytics and Xamarin.Firebase.iOS.Core packages into your Xamarin.iOS project. I don’t think the order of installing them matters, but I installed Crashlytics before Core.

2. Add the GoogleService-Info.plist file to your iOS project.

In your Firebase console, follow the SDK setup instructions until you get to Step 2. Download the .plist file and add it to your iOS project. Click on the file and set the Build Action to Bundle Resource.

3. Add Configure() calls to AppDelegate.

Find the FinishedLaunching() method in your AppDelegate.cs file. In the beginning of this method, put:

Firebase.Core.App.Configure();
Crashlytics.Configure();

You’ll need to add a using statement for Firebase.Crashlytics.

4. Does your iOS app reference the old Fabric Crashlytics? Well..

You need to remove the Fabric API key nodes from your Info.plist, or Crashlytics still won’t see any change. Thanks for Lucas for this answer. Specifically, remove the Fabric key element and the entire dict element after it, which contains the Fabric API key.

Guess what you don’t have to do? Anything to do with CocoaPods.

You’re welcome.

Advertisements