Get CrashLogs with Fabric Crashlytics

G

Crashlytics provides deep and actionable insights, even the exact line of code your app crashed on. While Crashlytics gives you powerful crash reporting, with one additional click you can enable real-time analytics that help you understand what’s happening in your app.

Installation:

1. Add kit to your Podfile.

use_frameworks!
pod ‘Fabric’
pod ‘Crashlytics’

Then run following command in your terminal

pod install

2. In Project Navigator select your project from targets -> go to Build Phase -> click on plus button and add “New Run Script Phase” and paste following code

“${PODS_ROOT}/Fabric/run” ba500759ec59e71c692c2e3e003edd73e25207c2 13fd4768392c1fb440b9bb7447dab03757c569a498a25c7e667fdbdefd52f57b

3. Add API in Info.plist file

<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>ba500759ec59e71c692c2e3e003edd73e25207c2</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>

 

Initialize Your Kit

In AppDelegate. swift file

import Fabric
import Crashlytics

Then in application DidFinishLaunch method

Fabric.with([Crashlytics.self])

 

To get User Information

  • Add following method in your appDelegate file and call this method after  Fabric.with([Crashlytics.self]) this
  • line of code.
  • func logUser() {
    // TODO: Use the current user’s information
    // You can call any combination of these three methods
    Crashlytics.sharedInstance().setUserEmail(“user@fabric.io”)
    Crashlytics.sharedInstance().setUserIdentifier(“12345”)
    Crashlytics.sharedInstance().setUserName(“Test User”)
    }

 

 

 

About the author

trupti.karale
By trupti.karale

Category