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.72k stars 2.22k forks source link

[🐛] Unable to build iOS after adding Auth dependency #7622

Closed Roshdy closed 9 months ago

Roshdy commented 9 months ago

Issue

:fire: I'm unable to build react-native iOS project after adding @react-native-firebase/auth due to the following error No known class method for selector 'getCustomDomain:' from this code snippet:

RCT_EXPORT_METHOD(configureAuthDomain : (FIRApp *)firebaseApp) {
  NSString *authDomain = [RNFBAppModule getCustomDomain:firebaseApp.name];
  DLog(@"RNFBAuth app: %@ customAuthDomain: %@", firebaseApp.name, authDomain);
  if (authDomain != nil) {
    [FIRAuth authWithApp:firebaseApp].customAuthDomain = authDomain;
  }
}

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "dependencies": { "@aws-sdk/client-s3": "^3.496.0", "@aws-sdk/lib-storage": "^3.496.0", "@freakycoder/react-native-bounceable": "^1.0.3", "@gorhom/bottom-sheet": "^4.5.1", "@invertase/react-native-apple-authentication": "^2.3.0", "@mapbox/geo-viewport": "^0.5.0", "@meteorrn/core": "^2.6.0", "@react-native-async-storage/async-storage": "^1.19.3", "@react-native-clipboard/clipboard": "^1.12.1", "@react-native-community/geolocation": "^3.1.0", "@react-native-community/hooks": "^3.0.0", "@react-native-community/netinfo": "^9.4.1", "@react-native-community/slider": "^4.5.0", "@react-native-firebase/analytics": "^18.8.0", "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/auth": "^18.8.0", "@react-native-firebase/dynamic-links": "^18.7.3", "@react-native-masked-view/masked-view": "^0.2.9", "@react-native-picker/picker": "^2.6.1", "@react-navigation/bottom-tabs": "^6.5.7", "@react-navigation/drawer": "^6.6.2", "@react-navigation/material-top-tabs": "^6.6.4", "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.12", "@react-navigation/stack": "^6.3.16", "@reduxjs/toolkit": "^1.9.5", "@rnmapbox/maps": "^10.0.15", "appcenter": "^5.0.0", "appcenter-analytics": "^5.0.0", "appcenter-crashes": "^5.0.0", "aws-sdk": "^2.1469.0", "axios": "^1.6.0", "bad-word-ar": "^1.1.1", "bad-words": "^3.0.4", "deprecated-react-native-prop-types": "^4.2.1", "ffmpeg-kit-react-native": "^6.0.2", "formik": "^2.4.5", "google-libphonenumber": "^3.2.34", "i18next": "^23.5.1", "lodash": "^4.17.21", "lottie-react-native": "^6.4.0", "moment": "^2.29.4", "react": "18.2.0", "react-i18next": "^13.2.2", "react-native": "0.72.5", "react-native-camera": "^4.2.1", "react-native-code-push": "^8.1.0", "react-native-collapsible": "^1.6.1", "react-native-config": "^1.5.1", "react-native-confirmation-code-field": "^7.3.1", "react-native-create-thumbnail": "^2.0.0-rc.2", "react-native-date-picker": "^4.3.3", "react-native-drop-shadow": "^1.0.0", "react-native-fast-image": "^8.6.3", "react-native-flash-message": "^0.4.2", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "^2.13.1", "react-native-get-random-values": "^1.9.0", "react-native-image-crop-picker": "^0.40.0", "react-native-image-picker": "^7.0.2", "react-native-image-viewing": "^0.2.2", "react-native-inappbrowser-reborn": "^3.7.0", "react-native-linear-gradient": "^2.8.3", "react-native-navigation-bar-color": "^2.0.2", "react-native-pager-view": "^6.2.1", "react-native-paper": "^5.11.2", "react-native-permissions": "^3.9.2", "react-native-phone-input": "^1.3.7", "react-native-progress": "^5.0.0", "react-native-qrcode-scanner": "^1.5.5", "react-native-qrcode-svg": "^6.2.0", "react-native-radial-gradient": "^1.1.3", "react-native-reanimated": "^3.5.2", "react-native-restart": "^0.0.27", "react-native-safe-area-context": "^4.7.2", "react-native-screens": "^3.29.0", "react-native-share": "^9.4.1", "react-native-shared-element": "^0.8.9", "react-native-skeleton-placeholder": "^5.2.4", "react-native-svg": "^13.14.0", "react-native-svg-transformer": "^1.1.0", "react-native-swipe-modal-up-down": "^1.1.0", "react-native-swiper": "^1.6.0", "react-native-swiper-flatlist": "^3.2.3", "react-native-tab-view": "^3.5.2", "react-native-video": "^5.2.1", "react-native-vision-camera": "^3.6.4", "react-navigation-shared-element": "^3.1.3", "react-redux": "^8.1.2", "react-timer-hook": "^3.0.7", "redux-persist": "^6.0.0", "redux-persist-transform-filter": "^0.0.22", "short-unique-id": "^5.0.3", "simpl-schema": "^1.13.1", "stream": "^0.0.2", "string-similarity": "^4.0.4", "uniforms": "^4.0.0-alpha.0", "uniforms-bridge-simple-schema-2": "^4.0.0-alpha.0", "uuid": "^9.0.1", "yup": "^1.3.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.11", "@tsconfig/react-native": "^3.0.0", "@types/lodash": "^4.14.198", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", "babel-eslint": "^10.1.0", "babel-jest": "^29.2.1", "babel-plugin-root-import": "^6.6.0", "babel-preset-expo": "^9.5.2", "eslint": "^8.50.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.8", "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "prettier": "^2.4.1", "react-native-dotenv": "^3.4.9", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "engines": { "node": ">=16" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby $RNMapboxMapsImpl = 'mapbox' # Resolve react_native_pods.rb with node to allow for hoisting source 'https://github.com/CocoaPods/Specs.git' def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') platform :ios, min_ios_version_supported prepare_react_native_project! setup_permissions([ # 'AppTrackingTransparency', # 'BluetoothPeripheral', # 'Calendars', 'Camera', # 'Contacts', # 'FaceID', # 'LocationAccuracy', # 'LocationAlways', # 'LocationWhenInUse', 'MediaLibrary', 'Microphone', # 'Motion', # 'Notifications', 'PhotoLibrary', # 'PhotoLibraryAddOnly', # 'Reminders', # 'SpeechRecognition', # 'StoreKit' ]) pod 'ffmpeg-kit-react-native', :podspec => '../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec' pod 'react-native-video/VideoCaching', :path => '../node_modules/react-native-video/react-native-video.podspec' pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec' pod 'RNFS', :path => '../node_modules/react-native-fs' linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'vibo' do config = use_native_modules! pod 'SRSRadialGradient', :path => '../node_modules/react-native-radial-gradient/ios' pod 'Firebase/DynamicLinks', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'Firebase/Analytics', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'Firebase/Auth', :modular_headers => true pod 'FirebaseAuth', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'Firebase', :modular_headers => true $RNFirebaseAsStaticFramework = true # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'viboTests' do inherit! :complete # Pods for testing end pre_install do |installer| $RNMapboxMaps.pre_install(installer) end post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) $RNMapboxMaps.post_install(installer) installer.pods_project.targets.each do |target| if target.name.include? "React-Core-AccessibilityResources" Pod::UI.puts "Removing [include] #{target.name} pod".red target.remove_from_project end end end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleName = @"vibo"; // 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 = @{}; [AppCenterReactNative register]; [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; [AppCenterReactNativeCrashes registerWithAutomaticProcessing]; [FIRApp configure]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else // return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; return [CodePush bundleURL]; #endif } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [RCTLinkingManager application:application openURL:url options:options]; } @end ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 14.2.1 CPU: (12) x64 Apple M2 Max Memory: 19.11 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 19.7.0 path: ~/.nvm/versions/node/v19.7.0/bin/node Yarn: version: 1.22.19 path: /usr/local/bin/yarn npm: version: 9.5.0 path: ~/.nvm/versions/node/v19.7.0/bin/npm Watchman: version: 2024.01.22.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/roshdy/.rvm/rubies/ruby-3.2.0/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.2 - iOS 17.2 - macOS 14.2 - tvOS 17.2 - visionOS 1.0 - watchOS 10.2 Android SDK: API Levels: - "27" - "30" - "31" - "33" - "34" Build Tools: - 27.0.3 - 28.0.3 - 30.0.2 - 30.0.3 - 31.0.0 - 33.0.0 - 34.0.0 System Images: - android-33 | Google Play Intel x86_64 Atom - android-34 | Google Play ARM 64 v8a - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11255304 Xcode: version: 15.2/15C500b path: /usr/bin/xcodebuild Languages: Java: version: 20.0.2 path: /usr/bin/javac Ruby: version: 3.2.0 path: /Users/roshdy/.rvm/rubies/ruby-3.2.0/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: 0.72.5 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: false newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ``` - **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:** - `@react-native-firebase/app@^18.7.3` - `@react-native-firebase/auth@^18.8.0` - **`Firebase` module(s) you're using that has the issue:** - `RNFBAuthModule` - **Are you using `TypeScript`?** - `Y` & `4.8.4`


mikehardy commented 9 months ago

  pod 'Firebase/DynamicLinks', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'Firebase/Analytics', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'Firebase/Auth', :modular_headers => true
  pod 'FirebaseAuth', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'Firebase', :modular_headers => true

This is unsupported configuration, you will receive no support here with modular_headers workarounds.

use_frameworks! :linkage => :static is strictly required, as documented.

My best guess on your build error is that you are overriding the firebase-ios-sdk version though, otherwise the method would be present and there would be no problem compiling against that symbol from our module code.

If you override the firebase-ios-sdk version you are at your own risk as warned https://rnfirebase.io/#overriding-native-sdk-versions

Roshdy commented 9 months ago

actually i also faced the same error on Android String authDomain = ReactNativeFirebaseAppModule.authDomains.get(appName);

Roshdy commented 9 months ago

You closed the issue, but I feel like there is something to look into here...

mikehardy commented 9 months ago

@Roshdy no there's not, sorry. Here's a complete yet minimal integration test that builds iOS in debug and release, as well as builds macCatalyst using the latest version https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

Your burden of proof here is very high as that script reproducibly builds things correctly.

If you are able to prove with a https://stackoverflow.com/help/minimal-reproducible-example that there is a problem, then we can reopen.

Until then, no, nothing to look into