invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.7k stars 2.22k forks source link

πŸ”₯[πŸ›] Crashlytics will not receive crash reports - iOS debug & release build #7308

Closed jadonhansen closed 12 months ago

jadonhansen commented 1 year ago

Issue

I am trying to initialise the crashlytics for the first time in my iOS build so that the Firebase console can detect any crashes/receive my logs. It works on Android and I am seeing logs. For iOS it does not work on debug or release build.

I am forcing the crash on the first screen of my app (not App.tsx):

import crashlytics from "@react-native-firebase/crashlytics";

export default function Home() {
       ...

    useEffect(() => {
        crashlytics().crash();
    });

     return (...);
}

Xcode output:

Screenshot 2023-08-22 at 16 47 00

The release scheme:

Screenshot 2023-08-22 at 16 47 21

My firebase.json:

{
    "react-native": {
        "crashlytics_debug_enabled": true,
        "crashlytics_disable_auto_disabler": true,
        "crashlytics_auto_collection_enabled": true,
        "crashlytics_is_error_generation_on_js_crash_enabled": true,
        "crashlytics_javascript_exception_handler_chaining_enabled": false,
        "android_bypass_emulator_url_remap": true
    }
}

I've updated to the latest MacOS running M2 chip. Xcode is on the latest version. Python3 is in the environment. Confirmed that pod install sees the firebase.json file and acts accordingly.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "digiwallet", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "@babel/core": "^7.20.0", "@kichiyaki/react-native-barcode-generator": "^0.6.7", "@react-native-async-storage/async-storage": "1.18.2", "@react-native-firebase/analytics": "^18.3.0", "@react-native-firebase/app": "^18.3.0", "@react-native-firebase/crashlytics": "^18.3.0", "@react-native-firebase/firestore": "^18.3.0", "@react-navigation/drawer": "^6.6.3", "@react-navigation/native": "^6.1.7", "@react-navigation/stack": "^6.3.17", "expo": "~49.0.5", "expo-barcode-scanner": "~12.5.3", "expo-camera": "~13.4.2", "expo-dev-client": "~2.4.6", "expo-haptics": "~12.4.0", "expo-image": "~1.3.2", "expo-linking": "~5.0.2", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", "expo-updates": "~0.18.11", "react": "18.2.0", "react-native": "0.72.3", "react-native-bouncy-checkbox": "^3.0.7", "react-native-gesture-handler": "^2.12.1", "react-native-google-mobile-ads": "^12.0.0", "react-native-notifier": "^1.9.0", "react-native-reanimated": "~3.3.0", "react-native-safe-area-context": "^4.7.1", "react-native-screens": "^3.24.0", "react-native-snap-carousel": "^3.9.1", "react-native-svg": "^13.11.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@types/react": "~18.2.14", "@types/react-native-snap-carousel": "^3.8.5", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", "eslint": "^8.46.0", "eslint-plugin-react": "^7.33.1", "typescript": "^5.1.3" }, "private": true } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_debug_enabled": true, "crashlytics_disable_auto_disabler": true, "crashlytics_auto_collection_enabled": true, "crashlytics_is_error_generation_on_js_crash_enabled": true, "crashlytics_javascript_exception_handler_chaining_enabled": false, "android_bypass_emulator_url_remap": true } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0' install! 'cocoapods', :deterministic_uuids => false prepare_react_native_project! # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this, # you can also exclude `react-native-flipper` in `react-native.config.js` # # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # } # } # ``` flipper_config = FlipperConfiguration.disabled if ENV['NO_FLIPPER'] == '1' then # Explicitly disabled through environment variables flipper_config = FlipperConfiguration.disabled elsif podfile_properties.key?('ios.flipper') then # Configure Flipper in Podfile.properties.json if podfile_properties['ios.flipper'] == 'true' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"]) elsif podfile_properties['ios.flipper'] != 'false' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] }) end end target 'DigiWallet' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] # Flags change depending on the env values. flags = get_default_flags() pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'FirebaseFirestore' pod 'FirebaseAnalytics' pod 'FirebaseSessions', :modular_headers => true pod 'FirebaseCoreExtension', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'nanopb', :modular_headers => true use_react_native!( :path => config[:reactNativePath], :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', :fabric_enabled => flags[:fabric_enabled], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", # Note that if you have use_frameworks! enabled, Flipper will not work if enabled :flipper_configuration => flipper_config ) post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" // firebase config #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // firebase config [FIRApp configure]; self.moduleName = @"main"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } // Linking API - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; } // Universal Links - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { return [super application:application didFailToRegisterForRemoteNotificationsWithError:error]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 13.5.1 CPU: (8) arm64 Apple M2 Memory: 95.95 MB / 8.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 16.16.0 path: /usr/local/bin/node Yarn: Not Found npm: version: 8.19.2 path: /usr/local/bin/npm Watchman: version: 2023.07.24.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10671973 Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 13.0.12 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.3 wanted: 0.72.3 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false info React Native v0.72.4 is now available (your project is running on v0.72.3). info Changelog: https://github.com/facebook/react-native/releases/tag/v0.72.4 info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.72.3 info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos&platform=android". ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `18.3.0` - **`Firebase` module(s) you're using that has the issue:** - `@react-native-firebase/crashlytics` - **Are you using `TypeScript`?** - `Y` & `5.1.3`


jadonhansen commented 1 year ago

BTW: I am aware that using :modular_headers => true in the podfile is not supported. If I can't receive support then so be it, just don't have any other work around for that at this point in time.

efkan commented 1 year ago

The same here.

We can use Analytics on iOS, and we can collect crash reports from the users who are on Android.

However, we cannot collect crashes from iOS devices.

CCB-cerivera commented 1 year ago

have managed to find a solution i have my app to version sdk49 of expo with "expo-notifications": "~0.20.1", and it doesn't work.

github-actions[bot] commented 1 year ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

julian-gargicevich commented 1 year ago

have managed to find a solution i have my app to version sdk49 of expo with "expo-notifications": "~0.20.1", and it doesn't work.

What was the solution?

github-actions[bot] commented 1 year ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.