The Firebase Crashlytics SDK permits builders to obtain real-time crash stories for his or her apps. It logs crashes and offers detailed details about their origins, enabling builders to handle and resolve points in subsequent app releases. This, in flip, enhances the app’s stability for customers. On this tutorial, we’ll discover ways to combine the Firebase Crashlytics SDK into an iOS app utilizing Swift.
Including Firebase SDK
Step one is so as to add the Firebase SDK and different dependencies to our undertaking. Comply with the steps beneath so as to add the Firebase SDK to your undertaking.
- Go to Firebase Console.
- Click on on Add undertaking.
- Enter your undertaking title.
- Hyperlink Google Analytics to the undertaking by following the steps proven within the Firebase console window.
- Choose your present location (nation you might be residing in).
- Settle for the phrases and situations, then click on on Create undertaking.
- Click on Proceed. A display screen along with your undertaking dashboard will open.
- Click on on the iOS icon as we need to add the Firebase SDK for iOS.
- Comply with the 5 steps given on the official webpage so as to add Firebase to your iOS app. Be aware that totally different set up strategies can be found, however the really useful methodology is by way of Swift Bundle Supervisor (SPM).
Utilizing Firebase Crashlytics SDK in iOS
Comply with beneath Steps:
- Drag and drop GoogleService-Data.plist into the undertaking folder.
- Open AppDelegate.swift and import Firebase, followe by configure command.
import UIKit import Firebase @predominant class AppDelegate: UIResponder, UIApplicationDelegate { func utility(_ utility: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override level for personalisation after utility launch. FirebaseApp.configure() return true } }

- Choose the undertaking in Venture Naviagtor
- Choose undertaking goal listed below TARGETS, in our case its ‘CrashlyticsDemo‘.
- Choose Construct Phases.
- Click on on + icon, then choose New Run Script Part.
- Below shell part add beneath run script
"${BUILD_DIR%/Construct/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
Be aware:- In case you are utilizing cocoa pods for set up, then it’s good to add given beneath shell command
"${PODS_ROOT}/FirebaseCrashlytics/run"
The above scripts is required as a result of crashlytics wants, app to add debug symbols with a purpose to use it to interchange the symbols within the crash logs with the suitable strategies names so will probably be readable and can make sense. Run script construct section for Xcode will routinely add debug symbols post-build.
Fore extra data test this hyperlink:
Subsequent steps is to add DYSM information. Within the Enter Recordsdata part, add the paths for the places of the next information:
- The placement of undertaking’s dSYM information:
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Assets/DWARF/${TARGET_NAME}
As per documentation, offering the placement of your undertaking’s dSYM information allows Crashlytics to course of dSYMs for giant apps extra shortly.
2. The placement of your undertaking’s constructed Data.plist
file:
$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
As per Firebase crashlytics documentation, offering the placement of your undertaking’s constructed Data.plist
file allows Crashlytics to affiliate an app model with the dSYMs.
Lastly, below Construct Settings of TARGETS and PROJECT. Seek for Debug data format, and set it as “DWARF with DYSM file”.

The place to go from right here
On this put up, we discovered 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 helpful factor to make use of within the cell app and many of the apps used it.