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 incidence in app subsequent launch and make app extra steady 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 mission. Comply with the beneath given steps so as to add Firebase SDK to the mission.
- Go to https://console.firebase.google.com/
- Click on on Add mission.
- Enter mission title.
- Hyperlink Google analytics to the mission.(Comply with the steps proven by Firebase console window)
- Choose present location(nation we’re residing in).
- Settle for situations and click on on create mission.
- Click on Proceed.
- A display with our mission dashboard will open up.
- Click on on iOS icon as we wish to add Firebase SDK for iOS.
- Comply with the 5 steps, as described within the net web page. (Word:- One can selected totally different set up strategies, however the really helpful one is by way of SPM(Swift Package deal Supervisor))
Utilizing Firebase Crashlytics SDK
Comply with beneath Steps:
- Drag and drop GoogleService-Data.plist into the mission folder.
- Open AppDelegate.swift and import Firebase, followe by configure command.
import UIKit import Firebase @important class AppDelegate: UIResponder, UIApplicationDelegate { func software(_ software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override level for personalization after software launch. FirebaseApp.configure() return true } }
- Choose the mission in Challenge Naviagtor
- Choose mission goal listed beneath TARGETS, in our case its ‘CrashlyticsDemo‘.
- Choose Construct Phases.
- Click on on + icon, then choose New Run Script Section.
- Underneath shell part add beneath run script
"${BUILD_DIR%/Construct/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
Word:- If you’re utilizing cocoa pods for set up, then it’s worthwhile to add given beneath 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.
Fore extra information verify this hyperlink: https://firebase.google.com/docs/ios/installation-methods
Subsequent steps is to add DYSM recordsdata. Within the Enter Recordsdata part, add the paths for the places of the next recordsdata:
- The placement of mission’s dSYM recordsdata:
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Sources/DWARF/${TARGET_NAME}
As per documentation, offering the placement of your mission’s dSYM recordsdata permits Crashlytics to course of dSYMs for giant apps extra shortly.
2. The placement of your mission’s constructed Data.plist
file:
$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
As per Firebase crashlytics documentation, offering the placement of your mission’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”.
The place to go from right here
On this put up, 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 method, it’s a really needy factor to make use of within the cell app.