Firebase Fabric Crashlytics not sending data to server - ios

I used Crashlytics for a long time since it was under the Twitter umbrella. I'm switching now to the new version integrated with Firebase but I can't get it to work correctly. I think I've done the integration correctly. Everything looks ok. However data doesn't get sent (or received). I think the problem is in this message that I get in the debug console (Xcode).
[Fabric] failed to download settings Error Domain=FABNetworkError Code=-5 "(null)" UserInfo={status_code=403, type=2, request_id=617cbe85f1d8e3c3973b275a8ff08564, content_type=application/json; charset=utf-8}
I believe that for some reason, the SDK is failing to download the configuration settings needed to then connect to the server and send back the crash reports. Firebase looks like is working fine, so it's an issue specific with Fabric/Crashlytics.
I couldn't find any answer to this specific error. Anyone else experiencing this?
To add to this, I can't see the new version of the app appearing in the dashboard. And this update has been released already to the public... with hundreds of thousands of installs already.

For me the problem was that the SDK doesn't recognise automatically the API Key that you should be able to set in the Info.plist.
Instead I had to pass it over to the URL in the build settings. (Old way to do it)...

If your app is running with "App Sandbox" capability, enable the "Outgoing Connections" checkbox.

Related

Can't get debug token for Firebase App Check for my Flutter iOS App

So I recently started setting up app check for my existing Flutter project (for both android and iOS platforms). I've had no problem with android's "Play Integrity", got the necessary debug token, and can successfully send and retrieve data to/from firestore (app check for firestore is currently enforced for my project).
The problem is, I can not get such a debug key for my iOS app. I will list the sources I've used and what I've tried so far.
I have firebase_app_check: ^0.1.1+8 installed via pubspec.yaml
I also added pod 'FirebaseAppCheck' to my Podfile
I have the necessary initialization code in my main.dart: await FirebaseAppCheck.instance.activate(...);
For "DeviceCheck", I am using THE SAME private key that I am using
for "Sign in With Apple" (which I have implemented successfully). I
have also enabled the checkbox for DeviceCheck in the settings of
that private key (in Apple Developer).
For my App ID (Apple Developer > Identifiers > App IDs), I have also
enabled the checkbox for "App Attest".
I have put "-FIRDebugEnabled" as an argument passed on launch in
XCode > Product > Scheme > Edit Scheme.
I always uninstall my app from my iOS simulator (iOS 16.2) or real device (iOS 16.1.2),
before trying again, because I have read across multiple forums that
the debug token only gets printed to the output the first time you
run your app.
I have also added these 4 lines of code in my AppDelegate.swift from here:
#if DEBUG
let providerFactory = AppCheckDebugProviderFactory()
AppCheck.setAppCheckProviderFactory(providerFactory)
#endif
Official firebase docs "iOS+ (App Attest)":
I have NOT copied ANY code from this page of the official docs, as I assume it's for native iOS apps only, and not for flutter, and I don't know where exactly I would have to put that code. I have only added the pod dependency and run pod install.
I don't have a .entitlements file.
So after all those steps, I'm apparently supposed to expect to find a debug token in my run output, as in:
Yet the only relevant output I can find is the following:
Runner[72719:33546579] 10.3.0 - [FirebaseFirestore][I-FST000001] AppCheck failed: 'The operation couldn’t be completed. (com.apple.devicecheck.error error 1.)'
If it matters:
I have NOT YET uploaded my iOS app to apple developer, app store connect or whatever (I'm not yet familiar with the process of publishing to the app store).
Neither have I uploaded my android app to Google Play console or created an app there (for this project).
Don't tell me anything about firestore rules. I already had that set up long ago, and everything worked just fine before I started integrating App Check.
Don't recommend any 3rd party plugins to me, I will only use official ones.
The firebase documentation says:
Tip: Confirm in your Xcode project's build settings that it passes the DEBUG flag to the Swift compiler
Try removing the '#if DEBUG' and '#endif' and run the app.
If it works, it mean you have missed that step
I was not able to find that build setting, so i just removed those lines from the AppDelegate, but i need to keep in mind to remove the other 2 lines while building the release mode
See this answer on the flutterfire Github issues page. Basically, call setAppCheckProviderFactory before GeneratedPluginRegistrant.register(with: self) in the app delegate file. I was investigating the same issue and it fixed it for me (the debug token was instantly printed out in Xcode's debug output). Hope it helps you as well!

Crashlytics report can be generated only after re run the app

I just implemented Fabric Crashlytics tool to my Xcode project via Swift Package Dependencies.
All works good if I enable Google Analytic on a step when I create an app, without this step I did not received crash reports, so I switched to the app with Google Analytic enabled.
I've tested crash button from the link:
One comment that I don't like from there
"After your app crashes, run it again from Xcode so that your app can
send the crash report to Firebase."
Does it mean that user has to reopen app to send crash report? For example if a user download an app from the App Store and then somehow the app is crashed. Does mean that reopening app required for sending that crash? And if the user will not open the app it means I lost this crash report? I understand that on live store there is no option to re run it form Xcode, but reopening seems a require step.
I suppose the crash report should work different a bit by sending issue details right after a crash, I may be wrong here.
Also when I set everything via Swift Package Dependencies looks like I don't have an option to upload dSYM via this option
/path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
Does this mean I need to pull Fabric and Crashlytics from CocoaPods?
I've switched off bitcode at the moment and looks like all is works automatically but not sure it is good idea for long perspective.
Yes, crashes will be uploaded when restarting the app after it crashes. As far as I know, this is because the SDK may not have enough time to actually send the report when the crash happens.
If you are using Swift Package Manager, you still have that option.
This is the command:
"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
If the app has bitcode enabled, then you'll need to download the dSYMs from the App Store and upload them manually.
Lastly, Fabric is now deprecated so don't download it. You don't need to use Cocoapods if you are already integrated Crashlytics with SPM.

Firebase Add iOS App Error - There was an unknown error while processing the request. Try again

I'm trying to add a new iOS app in my project on Firebase console and I'm getting this generic error.
There was an unknown error while processing the request. Try again.
I've tried to login again, didn't work. Also tried on several different browsers, didn't work too.
My project has just 23 apps and the same problem does not happens when I try to add a new Android App.
Are someone facing the same problem? What should I do?
This happened to me, I just signed out from Firebase/Google account and completely signed out of chrome and signed back in again. This worked.
The project was already created. So I just had to click on it, or you could try using another browser/device
If that won't work, try deleting some unused, preferably IOS, projects from the firebase console AND https://console.cloud.google.com/

How to debug generic React Native error messages on iOS?

Unless I enable debugging (Esc > Cmd+D > Debug JS Remotely) then I see this error:
Module AppRegistry is not a registered callable module
This also means that I'm unable to view the bundled app on device. If I try to view the app on device, but still use the dev server (remembering to use an IP address in AppDelegate.m instead of localhost) then I instead get this error:
WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
even though I've verified that I can open the dev server URL in a browser on the device.
I'm not an iOS developer, so maybe this is really obvious, but how do I go about debugging why these errors are happening, or just not having these errors in the first place?
One reason could be App Transport Security that was added in iOS 9. Please see https://facebook.github.io/react-native/docs/running-on-device-ios.html#app-transport-security for reference. You have to add the NSAllowsArbitraryLoads entry to your Info.plist yourself if you didn't use the React Native CLI to generate your project.
Although this doesn't really answer the 'How do I debug these kinds of generic errors' question, I've found out that in my case the problem was that I created my app using an older version of RN (maybe 0.26?) that had a bug in the scaffolding code it creates (which I stupidly ignored at the time when I found i could work around it by enabling debugging) and updating to newer versions of the app hasn't fixed the issue because that doesn't cause the scaffolding to be updated. By creating a fresh app under RN 0.29, and copying my code into it, everything is now working as expected.

Crash reporting using Crashlytics Fabric not working after updates

Referring to this post: Crashlytics not reporting crash in Release mode :
I have done every single change the original poster has mentioned already including the changes mentioned in the answer but I still can't get crashes to be displayed in the dashboard for release.
The only difference is that I am using Jenkins to make my release builds. If I run the app locally from Xcode (and of course stop Xcode and restart the app on its own so the debugger doesn't get in the way), reports are being recorded and displayed just fine.
I have also implemented the Crashlytics Delegate method to make sure the crash is indeed being logged and it is. It just never shows up in the dashboard if it is a Jenkins build.
Would anyone have any insight on what might be happening?
I am not using Jenkins, but the problem that happened to me was that I was using the Fabric Mac App to apply the API key through the setup process.
For me the fix was simply:
Go to fabric.io -> Organisations -> Your org -> API key
and remplace this:
Fabric.with([Crashlytics.self])
by:
Fabric.with([Crashlytics.start(withAPIKey: "YOUR_API_KEY")]
This way you can force Fabric to use your API key. My guess is that when Jenkins builds your app, it doesn't have access the the Fabric App and thus can not set the proper API Key.

Resources