Now a days Fabric is sending notice for migrating, as I got email today about [FINAL NOTICE] Fabric is shutting down May 4, 2020. 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.
1 |
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.
1 |
pod install |
Step 3 – Add Run Script
1 |
"${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
1 |
import Firebase |
Objective-C
1 |
@import Firebase; |
Step 2 – Configure a FirebaseApp
shared instance, in your app’s application:didFinishLaunchingWithOptions:
method:
Swift
1 |
FirebaseApp.configure() |
Objective-C
1 |
[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
1 |
fatalError() |
Objective-C
1 |
assert(NO); |
You can check Firebase Crashlytics console for this test crash.
I hope you learned something. You may also check out this article from Toptal about: How to Build a Role-based API with Firebase Authentication. 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 ?