Firebase Crashlytics setup for flutter on flutter ios - ios

Basically, I want to set up Crashlytics for flutter in the ios application but I don't find any proper docs dedicated to ios in the flutterfire docs and I try different tutorials but nothing works. please guide me !!

after you define your app in firebase console and download the "GoogleService-Info.plist":
you must add it to ios folder in flutter app:
you must add the bellow package to pubspec.yaml file and use it like below link:
dependencies:
firebase_crashlytics: ^2.7.1
https://pub.dev/packages/firebase_crashlytics/example
(This step is optional) After that, you can add the below script to the build phase for
Crashlytics requires you to upload debug symbols.
You can use a run script build phase for Xcode to automatically upload debug symbols post-build. Find the run script here:
https://firebase.google.com/docs/ios/installation-methods?authuser=0
"${PODS_ROOT}/FirebaseCrashlytics/run"
you must enable crashlytics in firebase console:
this works(enables) when you crash manually on the button tap (it means that after you launch your app you must make a crash to send a signal to your crashlytics) after that your crashlytics enables.

Related

Upload dSYM files to Firebase Crashlytics without having GoogleService-Info.plist files

In order to enable Crashlytics for my Flutter app (with 3 flavors) i would like to know how the repeating upload of the symbols for the iOS project can be done when i configured Firebase in dart-only mode (i.e. i didn't have to download the GoogleService-Info-plist files for my 3 flavors)?
I've read that i could enter scripts for the upload in XCode under Targets Runner --> Build Phases
...but i wonder how i could differentiate between my 3 flavors, i.e what upload scripts are called if i e.g. build for staging environment?
Also it would be interesting to know if those symbol uploads would happen as well when i build/run the app in my Flutter IDE (IntelliJ).
When using Crashlytics with Flutter, the Crashlytics SDK is integrated using CocoaPods. Because of this, this would be the run script you should be using for your app:
"${PODS_ROOT}/FirebaseCrashlytics/run"
In this case, the script will try to locate the configured GoogleSErvices-Info.plist. However, you can pass the app ID as argument and in that case, the plist file is no longer required.
"${PODS_ROOT}/FirebaseCrashlytics/run" --app-id <your app ID>
You can find the app ID in your Firebase project settings.
I'm not sure how your project is configured, but you would need to run this command for your flavors or targets.
Lastly, when building the app, I believe that Flutter will invoke the Xcode builder, which should execute the run script too.

CRASH: Option C - Embed application and plugin frameworks in Xcode and Flutter framework with CocoaPods

I have created a flutter module to integrate in native iOS.
Later created a pod file for that module.
Followed below link Option-C.
https://flutter.dev/docs/development/add-to-app/ios/project-setup
When I run the app on simulator it works fine but on device its get crash immediately on launch.
Steps:
Added some flutter pod library in 'Framework, Libraries and Embedded Content'.
Modified Embed as "Do Not Embed".
Created a build (.ipa file).
It install successfully but gets crash immediately on launch.

Why does xCode cannot build my flutter app with 'sqflite' not found error

I'm trying to build my Flutter app for iOS using xCode and got error:
.../ios/Runner/GeneratedPluginRegistrant.m:10:9: Module 'sqflite' not found
When I'm trying to build application with flutter with command
flutter build ios
I don't have any problem. Application build successfully.
I tried to delete Pod directory in ios folder and then install pods from scratch
flutter pub get
pod install
How to fix this problem with xCode?
XCode gives this type of Error like Module 'something' not found, when sometimes the problem is somewhere else.
So, what I did is after running flutter build ios command, I didn't try to run it in XCode. Because it was giving these errors.
So, I archived the app and tried to publish in App Store Connect. Then I found the real issue/bug on my code.
App store doesn't support transparent logo or app icon. This was the bug in my case.
So you can try to archive and publish to app store connect. It may show you the real reason.
Change your target Destination to > Any iOS Device
This work for me
"I found the solution,
In the existing project, once you guys add sqflite dependencies
Profile file in IOS folder will not generate code
we need to remove Podfile in ios
rm ios/Podfile
and run the project again, it works for me."
Credit:thanks to viroth-geek

Crashlytics not recording crashes for archived builds

I am trying to integrate Crashlytics in my project. I have successfully added Crashlytics using Cocoapods
I have added Fabric run and upload symbols script in Build Phases.
Order of Run scripts are UploadSymbols > Fabric run
Also set Debug information format to DWARF with dSYM File
Enable Bitcode is set to YES
Added FirebaseApp.configure() in AppDelegate.swift
and added Crashlytics.sharedInstance().crash() in code to force a crash.
I can see crash logs in Firebase-Crashlytics console when I run in debug mode > stop > launch app again > force crash.
But when I archive and upload to App Center (Enterprise Build), crashes are not showing in Firebase console.
dSYM required error showing. I can see the version in both cases.
Not sure if I am missing anything.
Enterprise build is created using Fastlane.
IDE: Xcode 11.3.1
Thanks in advance.

Crashlytics not working with ionic framework

I am having an iOS ionic application in which I am trying to incorporate crashlytics, for that I have added cordova crashlytics plugin.After that I launched the Fabric application and selected new application > projects xcode file > install crashlytics
after this step I added a run script build phase with the code in the fabric application and then build and run the application using xcode, but nothing is happening in the fabric application.
Attaching the screenshot.
I faced similar problem trying to integrate Crashlytics into an Ionic app. The following worked for me.
Install the cordova-fabric-plugin:
ionic plugin add cordova-fabric-plugin --variable FABRIC_API_KEY={api-key} --variable FABRIC_API_SECRET={api-secret} --save
This will automatically add a build phase script to the XCode Project.
Build and Run the project. The build phase script uploads a dSYM file which Crashlytics uses to process the crashes.
The first run after build is important as it identifies the build with the Crashlytics platform.

Resources