How to get Crash logs from your iOS application installed in user’s device.?

Errors can happen to anyone even if it is a developer or theCEO of the company. Most of us know how important are the crash reports. As a beginner, if you have already uploaded apps to the Play store or Appstore and you have no idea how to get the crash logs from the user’s device, be patience, I will show you how to do it.

Getting the error details from the user’s device without annoying the user. That is what Crash report is all about.

I would like to share the some thoughts about google’s firebase. It’s a great product for mobile application developers.



Firebase is basically a cloud service provider. It provides lots of free and paid features such as App Analytics, Storage, Realtime Database, Authentication, Cloud Messaging, Crash Reporting and etc…

In your firebase free tier account you will get these benefits,

  1. Firebase provides App Analytics and Crash Reporting  as a free too for all the users.
  2. You can host up to 5GB data in your free tier account.
  3. 1GB database is free database storage.
  4. You can host your static website and contents. You will have 1GB space for this.


Unfortunately you cannot run your server side code there.


Lets go through Crash reporting and its configurations step by step.


  • Create a Xcode project and name it as CrashHandlers.
  • You have to register an account in firebase.
  • Goto console
  • Create a new cloud project and name it as MyTestCrashHandling.
  • Fill the necessary fields and initiate the cloud project.


  • Download the configuration file from console. (GoogleService-Info.plist)
  • Add that to your xcode project.






Add firebase sdk and set up Crash Reporting to the xcode project

  • Open the terminal and do the following steps carefully.


$ cd  CrashHandlers-project-directory
$ pod init



There will be a [code]Podfile[/code] generated.


add the following pods,



pod ‘Firebase/Core’
pod ‘Firebase/Crash’



Install the pods and open the [code].xcworkspace[/code] file to see the project in Xcode. see below



$ pod install
$ open CrashHandlers-project.xcworkspace





Generate service account key file from firebase console

In order to authenticate your file uploads You have to create service account key

  1. Goto console
  2. Goto Permissions page like below

Add image here….



3. Goto Service Accounts tab and create a new Service Accounts like below,













  • You willbe prompted to download the json key file (MyTestCrashHandling-f9b0e09b6a42.json) and save it in your project folder.

Add an upload script for your symbol files

  • Open your xcode project and select target as project




  • Goto Build Phases, Like below click `+` to add  Run Script  phase




  • Add the following contents


# Get the GOOGLE_APP_ID from your GoogleService-Info.plist file

# Replace the path with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "ServiceAccount.json path"





Thats all, Now go to AppDelegate’s [code]didFinishLaunchingWithOptions[/code] method and initiate the firebase and throw an exception. See below.




Now build the app and run with your device or simulator. Debugger will not allow you to run your application due to the fatal error.

Stop your app and run your app manually (By clicking on the app)

Now you will notice app will crash and shutdown.

comment the [code]fatalError()[/code] call in the [code]didFinishLaunchingWithOptions[/code] method.

Now run your app again. You can notice the error log has uploaded successfully.




Goto firebase console and open the project. You will notice the changes. i will add you some of my firebase console images.








If you have missed any of the above steps, you will not get the result. Keep following with the next blog. Please let me know if you need any help.


Thank you very much.



Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.