How to add new Firebase Crahlytics SDK to your iOS project?
Now a days Fabric is sending notice for migrating, as I got email about [FINAL NOTICE] Fabric is shutting down May 4, 2020 means Today! We can move to the new Firebase Crashlytics SDK.
Integrating the new Firebase Crashlytics SDK is quick and easy. Let’s take a look.
Installation
If your project is not configured in Firebase then create project on Firebase console and configure it in your project. After that follow the steps:
Step 1 — Go to your Podfile and add Firebase Crashlytics Pods in your project.
pod 'Firebase/Crashlytics'
Note: Don’t forget to remove Fabric pod if you have already integrated Fabric Crashlytics
Step 2 — Install Pods and open your workspace.
pod install
Step 3 — Add Run Script
"${PODS_ROOT}/FirebaseCrashlytics/run"
Note: If your project already have then don’t forget update the run script as above.
Configure
Firebase Crashlytics will be configured as follows:
Step 1 — Import Firebase module in your UIApplicationDelegate
:
Swift
import Firebase
Objective-C
@import Firebase;
Step 2 — Configure a FirebaseApp
shared instance, in your app's application:didFinishLaunchingWithOptions:
method:
Swift
FirebaseApp.configure()
Objective-C
[FIRApp configure];
Note: If your project already have other functionality of Firebase then above step is not required.
Run and Crash
Clean build and run the project. If you want to test your implementation then use following command.
Swift
fatalError()
Objective-C
assert(NO);
You can check Firebase Crashlytics console for this test crash.
I hope you learned something. If you did, feel free to share this article with a friend or on social media. Let me know if you have any questions, comments or feedback — either via Twitter or email.
Stay Safe At Home. Learn Something New. Share To The World.
Happy Coding 🙂
Originally published at https://ashishkakkad.com on April 29, 2020.