Tuesday, September 27, 2022
HomeiOS DevelopmentCombine Google Firebase Crashlytics in iOS app utilizing swift – iOSTutorialJunction

Combine Google Firebase Crashlytics in iOS app utilizing swift – iOSTutorialJunction


Firebase crashlytics SDK helps builders to get actual time crash stories of their apps. Crashlytics SDK logs down a crash and supply info to the developer the place precisely its coming from. This fashion, developer can repair crash prevalence in app subsequent launch and make app extra secure to its customers. On this tutorial, we’re going to learn to combine Firebase Crashlytics SDK in our iOS app utilizing swift language.

Including Firebase SDK

Very first thing we have to add Firebase SDK and different dependencies to our challenge. Observe the under given steps so as to add Firebase SDK to the challenge.

  1. Go to https://console.firebase.google.com/
  2. Click on on Add challenge.
  3. Enter challenge identify.
  4. Hyperlink Google analytics to the challenge.(Observe the steps proven by Firebase console window)
  5. Choose present location(nation we’re residing in).
  6. Settle for circumstances and click on on create challenge.
  7. Click on Proceed.
  8. A display screen with our challenge dashboard will open up.
  9. Click on on iOS icon as we wish to add Firebase SDK for iOS.
  10. Observe the 5 steps, as described within the net web page. (Observe:- One can selected completely different set up strategies, however the advisable one is through SPM(Swift Bundle Supervisor))

Utilizing Firebase Crashlytics SDK

Observe under Steps:

  • Drag and drop GoogleService-Data.plist into the challenge folder.
  • Open AppDelegate.swift and import Firebase, followe by configure command.
import UIKit
import Firebase

@foremost
class AppDelegate: UIResponder, UIApplicationDelegate {

    func software(_ software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override level for personalisation after software launch.
        FirebaseApp.configure()
        return true
    }
}
Add run script for Firebase crashlytics in xcode iOS
  1. Choose the challenge in Mission Naviagtor
  2. Choose challenge goal listed beneath TARGETS, in our case its ‘CrashlyticsDemo‘.
  3. Choose Construct Phases.
  4. Click on on + icon, then choose New Run Script Section.
  5. Underneath shell part add under run script
"${BUILD_DIR%/Construct/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"

Observe:- In case you are utilizing cocoa pods for set up, then it’s essential add given under shell command

"${PODS_ROOT}/FirebaseCrashlytics/run"

The above scripts are required as crashlytics requires, app to add debug symbols. Run script construct section for Xcode will routinely add debug symbols post-build.

Subsequent steps is to add DYSM recordsdata. Within the Enter Recordsdata part, add the paths for the places of the next recordsdata:

  1. The situation of challenge’s dSYM recordsdata:
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Sources/DWARF/${TARGET_NAME}

As per documentation, offering the situation of your challenge’s dSYM recordsdata permits Crashlytics to course of dSYMs for giant apps extra rapidly.

2. The situation of your challenge’s constructed Data.plist file:

$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

As per Firebase crashlytics documentation, offering the situation of your challenge’s constructed Data.plist file permits Crashlytics to affiliate an app model with the dSYMs.

Lastly, beneath Construct Settings of TARGETS and PROJECT. Seek for Debug info format, and set it as “DWARF with DYSM file”.

Debug information format, and set it as DWARF with DYSM file  xcode ios firebase crashlytics

The place to go from right here

On this submit, we realized about how can we use Firebase crashlytics in iOS app utilizing swift language. Given benefits offered by crashlytics to report crash inside app in a really descriptive approach, it’s a really needy factor to make use of within the cell app.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

3 × five =

Most Popular

Recent Comments