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.69k stars 2.21k forks source link

[🐛] Unhandled JS Exception: Error: RNFirebase core module was not found natively on iOS, ensure you have correctly included the RNFirebase pod in your projects `Podfile` #6088

Closed Alex-vn-boulme closed 2 years ago

Alex-vn-boulme commented 2 years ago

Hi,

I'm facing an issue since I changed my MacBook Pro. When I build my app in debug mode, everything works fine but when I switch in "edit scheme' to release mode I get the following issue : "Unhandled JS Exception: Error: RNFirebase core module was not found natively on iOS, ensure you have correctly included the RNFirebase pod in your projects Podfile"

I noticed that I had pods from V5 version in the "build settings" > "Other linked flags" like "FirebaseCore" and much more :

Capture d’écran 2022-02-22 à 19 19 43

But I'm supposed to use V6 now.

Also it used to work on my previous computer I'm now using a M1 pro chip mac but I'm running xcode and terminal under rosetta, I guess the problem is doesn't come from this but I prefer mentionning it.

Any help would be appreciated, thanks a lot !

Javascript

Click To Expand

#### `package.json`: ```json { "name": "XXXXX", "version": "1.1.24", "private": true, "scripts": { "start": "react-native run-ios", "test": "jest", "lint": "eslint .", "ios": "react-native run-ios", "postinstall": "patch-package", }, "dependencies": { "@google-cloud/tasks": "^2.3.6", "@react-native-clipboard/clipboard": "^1.7.0", "@react-native-community/async-storage": "^1.6.3", "@react-native-community/checkbox": "^0.4.1", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/progress-bar-android": "^1.0.3", "@react-native-community/progress-view": "^1.2.1", "@react-native-community/push-notification-ios": "^1.8.0", "@react-native-community/toolbar-android": "^0.1.0-rc.2", "@react-native-firebase/analytics": "^11.2.0", "@react-native-firebase/app": "11.2.0", "@react-native-firebase/auth": "^11.2.0", "@react-native-firebase/dynamic-links": "^11.2.0", "@react-native-firebase/firestore": "^11.2.0", "@react-native-firebase/messaging": "^11.2.0", "@react-native-firebase/storage": "^11.2.0", "@skele/components": "^1.0.0-alpha.40", "@stripe/stripe-react-native": "^0.2.2", "eslint-plugin-promise": "^4.2.1", "formik": "^2.1.0", "i18n-js": "^3.5.0", "invert-color": "^2.0.0", "jest-haste-map": "^25.1.0", "jest-serializer": "^25.1.0", "jest-worker": "^25.1.0", "lodash": "^4.17.15", "lodash.isequal": "^4.5.0", "lodash.memoize": "^4.1.2", "mobx": "^5.14.0", "mobx-react": "^6.1.3", "moment": "^2.24.0", "native-base": "^2.13.8", "numeral": "^2.0.6", "package-update": "^1.0.0", "react": "16.9.0", "react-native": "0.61.4", "react-native-actionsheet": "^2.4.2", "react-native-animatable": "^1.3.2", "react-native-app-intro-slider": "^3.0.0", "react-native-button": "^2.4.0", "react-native-camera": "^3.8.0", "react-native-confirmation-code-field": "^4.1.0", "react-native-dark-mode": "^0.2.0-rc.1", "react-native-datepicker": "^1.7.2", "react-native-device-info": "^7.3.1", "react-native-dialog-input": "^1.0.7", "react-native-email-action": "^1.0.5", "react-native-fast-image": "^7.0.2", "react-native-fbsdk": "1.1.1", "react-native-geocoding": "^0.4.0", "react-native-gesture-handler": "^1.4.1", "react-native-google-places-autocomplete": "^1.3.9", "react-native-hyperlink": "^0.0.19", "react-native-image-pan-zoom": "^2.1.12", "react-native-image-picker": "^1.1.0", "react-native-image-progress": "^1.1.1", "react-native-image-view": "^2.1.6", "react-native-indicators": "^0.17.0", "react-native-iphone-x-helper": "^1.2.1", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-keyboard-aware-view": "0.0.14", "react-native-localize": "^1.3.1", "react-native-maps": "0.26.1", "react-native-modal": "^11.4.0", "react-native-modalbox": "^2.0.0", "react-native-paypal": "^2.1.0", "react-native-pdf": "^6.2.2", "react-native-phone-input": "^0.2.4", "react-native-progress": "^4.0.3", "react-native-push-notification": "^7.2.3", "react-native-reanimated": "^1.2.0", "react-native-screens": "^1.0.0-alpha.23", "react-native-search-box": "0.0.19", "react-native-sectioned-multi-select": "^0.8.1", "react-native-select-picker": "^0.0.3", "react-native-simple-radio-button": "^2.7.4", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.0.3", "react-native-swiper": "^1.6.0-nightly.5", "react-native-tiny-toast": "^1.0.7", "react-native-tracking-transparency": "^0.1.0", "react-native-vector-icons": "^6.6.0", "react-native-version-check": "^3.4.2", "react-native-video": "^5.0.2", "react-native-view-more-text": "^2.1.0", "react-native-webview": "^9.0.2", "react-navigation": "^4.0.7", "react-navigation-drawer": "^2.3.2", "react-navigation-redux-helpers": "^3.0.3", "react-navigation-stack": "^1.9.0", "react-navigation-tabs": "^2.5.5", "react-redux": "^7.1.1", "redux": "^4.0.4", "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0", "remote-redux-devtools": "^0.5.16", "rn-fetch-blob": "^0.12.0", "uuidv4": "^5.0.1" }, "devDependencies": { "@babel/core": "7.6.0", "@babel/plugin-proposal-decorators": "^7.6.0", "@babel/runtime": "7.6.0", "@react-native-community/eslint-config": "0.0.3", "babel-eslint": "^10.1.0", "babel-jest": "24.9.0", "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^7.6.0", "eslint-plugin-react": "^7.20.5", "jest": "24.9.0", "metro-react-native-babel-preset": "^0.59.0", "react-native-dotenv": "^0.2.0", "react-test-renderer": "16.8.6" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json { "emulators": { "functions": { "port": "5001" } }, "hosting": { "site": "XXXXXXXXXX", "public": "firebaseWebHosting", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] }, "react-native": { "crashlytics_disable_auto_disabler": true, "crashlytics_debug_enabled": true } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby `platform :ios, '11.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' post_install do |installer| installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' end ## Fix for XCode 12.5 beta find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm","_initializeModules:(NSArray> *)modules", "_initializeModules:(NSArray *)modules") find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm","RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))") end target 'XXXXX' do # Stripe pod 'Stripe', '~> 21.8.1' pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' pod 'GoogleMaps' # Remove this line if you don't want to support GoogleMaps on iOS pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART' pod 'react-native-webview', :path => '../node_modules/react-native-webview' use_native_modules! end target 'XXXXX prod' do # Stripe pod 'Stripe', '~> 21.8.1' pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' pod 'GoogleMaps' # Remove this line if you don't want to support GoogleMaps on iOS pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART' pod 'react-native-webview', :path => '../node_modules/react-native-webview' use_native_modules! end def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) if text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end` ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import #import #import "RNPaypal.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } [FIROptions defaultOptions].deepLinkURLScheme = @"com.XXX.ios.XXX"; UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)completionHandler:^(BOOL granted, NSError * _Nullable error) { if (granted) { center.delegate = self; } }]; [[RNPaypal sharedInstance] configure]; [BTAppSwitch setReturnURLScheme:@"com.XXX.XXXX.payments"]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"Socialnetwork" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { // Still call the JS onNotification handler so it can display the new message right away NSDictionary *userInfo = notification.request.content.userInfo; NSLog(@"APP_PUSH from foreground %@", userInfo); [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:^void (UIBackgroundFetchResult result){}]; completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } -(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { NSMutableDictionary *userData = [NSMutableDictionary dictionaryWithDictionary:response.notification.request.content.userInfo]; [userData setObject:@YES forKey:@"userInteraction"]; [RNCPushNotificationIOS didReceiveRemoteNotification:userData]; } -(void)applicationDidBecomeActive:(UIApplication *)application { UIApplication.sharedApplication.applicationIconBadgeNumber = 0; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { BOOL handled = [[RNPaypal sharedInstance] application:application openURL:url options:options]; return handled; } @end ```


Environment

Click To Expand

**`react-native info` output:** ``` info Fetching system and libraries information... (node:79362) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) System: OS: macOS 12.2.1 CPU: (8) x64 Apple M1 Pro Memory: 64.91 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.2.0 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 8.3.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-cli: 2.0.1 react-native-scripts: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [X] **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:** - `7.9.0` - **`Firebase` module(s) you're using that has the issue:** - `analytics, app, auth, dynamic-links, messaging, firestore,storage` - **Are you using `TypeScript`?** - `N`

mikehardy commented 2 years ago

Hi there!

1- don't use rosetta unless you have to, this is a solved problem - https://github.com/Yonom/react-native/blob/65f7e8f7a8a4025dca64a52ae856c2518b26c212/scripts/react_native_pods.rb#L219-L253 / https://github.com/facebook/react-native/blob/b1a779392d483c649d428debfe4a6405247b8c0e/template/ios/Podfile#L35

2- everything builds fine if integrated correctly, so this will be a project-specific problem. I just did iOS release builds today on a work project with react-native-firebase 14.5.0, no problems - https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh / https://stackoverflow.com/help/minimal-reproducible-example

stale[bot] commented 2 years 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 the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.