Firebase – Report Crash to Server on iOS

A quick tip here for reporting a crash issue to firebase server. This will help you to do a quick debug. For ios, we might need to upload symbol files to the firebase server for creating the log and point out crashed at which function.

So, here are some instructions.

  1. create Podfile and add following codes.
pod 'Firebase/Core'
pod 'Firebase/Crash'
pod 'Firebase/RemoteConfig'

Core component is for core functionalities of firebase you will need to initialize. Crash component is for interacting with firebase crash report system. RemoteConfig component is for remote config setting on firebase, developer can use this feature to remotely change the App setting with re-publish App.

If you don’t wanna user Cocoapods to install above listed libraries. You might need to download the firebase SDK from here. You need to manually add this SDK into project, and remember to add Objc link flag into Other Linker Settings, check more information from Apple

After finishing setup, you need to enable firebase in your project.

@import Firebase;

// put this line into application:didFinishLaunchingWithOptions:
[FIRApp configure];

Start preparing upload symbol files for each building. Going to firebase console. Select Crash reporting and save your firebase application id. For example:

Firebase iOS Application

Select “generate new private key”.


Go back your iOS project in XCode, open “Build Phases” page, and click “+” to add a new run script. Add following code into the script. For example, my app id is “1:71514373360:ios:55ce80d803737fda” and my json file put in the root path of project.

# Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist file

# Replace the /Path/To/ServiceAccount.json with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "demoproject-db17f-firebase-crashreporting-d37nm-032d2ff8bd.json"

Then done. We will upload each symbol file to server when we release our app.

But I encounter a weird issue. When I run the script to build project.

    "error" : "invalid_grant", 
    "error_description" : "Invalid JWT: Token must be a short-lived token and in a reasonable timeframe" 

I found the root-caused. Cause my laptop’s time is not time-synchronized. Someone on StackOver said server only allows about 5 mins lag. That’s the reason why developers might see this error message.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s