Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] Bug Report Title - FirebaseStorage/FirebaseStorage-swift.h file not found #7319

Closed
mrkhuram opened this issue Aug 31, 2023 · 6 comments
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report

Comments

@mrkhuram
Copy link

mrkhuram commented Aug 31, 2023

I just installed the @react-native-firebase/storage and my app build failed on iOS with an error
Screenshot 2023-08-31 at 13 34 35

Here is my Package.json file


{
  "name": "sbsApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "format": "prettier --loglevel warn --write \"**/*.{tsx,ts,js,jsx}\""
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.19.3",
    "@react-native-firebase/app": "^18.3.0",
    "@react-native-firebase/auth": "^18.3.1",
    "@react-native-firebase/storage": "^18.3.1",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@reduxjs/toolkit": "^1.9.5",
    "@rneui/base": "^4.0.0-rc.8",
    "@rneui/themed": "^4.0.0-rc.8",
    "@types/react-redux": "^7.1.26",
    "axios": "^1.4.0",
    "firebase": "^10.3.0",
    "react": "18.2.0",
    "react-native": "0.72.4",
    "react-native-animated-ellipsis": "^2.0.0",
    "react-native-device-info": "^10.8.0",
    "react-native-eject": "^0.2.0",
    "react-native-element-dropdown": "^2.9.0",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "^2.12.1",
    "react-native-image-picker": "^5.6.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-nfc-manager": "^3.14.6",
    "react-native-reanimated": "^3.4.2",
    "react-native-safe-area-context": "^4.7.1",
    "react-native-screens": "^3.24.0",
    "react-native-vector-icons": "^10.0.0",
    "react-redux": "^8.1.2",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2"
  },
  "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/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }
}

Pod file

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!
 
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  # use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
end

target 'sbsApp' do
  config = use_native_modules!


  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'GTMSessionFetcher', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => 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],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'sbsAppTests' do
    inherit! :complete
    # Pods for testing
  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)
  end
end


environment

Node v 18.17.1
npm v 9.6.7
xcode 14.2

It is working fine on Android but build failed on iOS only

@mrkhuram mrkhuram added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Aug 31, 2023
@mikehardy
Copy link
Collaborator

mikehardy commented Sep 3, 2023


  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'GTMSessionFetcher', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

This is a workaround to avoid use_frameworks contrary to what is directed in our docs: https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

It is not supported. as It leads to compilation errors such as this.

@adnan-jamil
Copy link

Hi @mikehardy, I see that the issue is marked as completed but the solution doesn't help. I have tried modular_headers => true. I used use_frameworks with static and also use_frameworks! but the error doesn't go away.

I have deleted pods, reinstalled them, deleted node-modules, reinstalled them, but nothing seems to be working. I really need help on this one because I am stuck on this for past 12-13 hours.

@mikehardy
Copy link
Collaborator

Sorry @adnan-jamil - I do not reproduce problems like that, and I build test things near-daily in order to troubleshoot issues for users here and to test dependency upgrades within my app and react-native-firebase, using this script which reproduces successful builds: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

Please note that no solution involving modular_headers will be valid. Do not add any Podfile directives like that, there should be exactly zero modular_headers directives in the Podfile.

Use only use_frameworks! :linkage => :static, remove ios/Pods and perhaps ios/Podfile.lock, reinstall Pods, and try again. It really should work. If not, I'll need a public reproduction you can point to on github, as I have pointed to one that reproduces success in a fully automated way the burden of proof that there is a problem in the repo is pretty high

@VGerris
Copy link

VGerris commented Jan 6, 2025

Thank you @mikehardy your instructions work for me. @adnan-jamil did you follow exactly what is written in the post above ? I have to say I am quite surprised with the amount of things one has to do to get these things to work from a basic monorepo started based on Expo, RN, Next and Solito.
I am interested to make pull request if any of these changes would be accepted .
Could for example be great to add some scripts that check for use of Firebase and then mod the Podfile or spec files accordingly to make things work.
Glad it does work now anyway, thank you !

@mikehardy
Copy link
Collaborator

@VGerris I believe in the Expo use case it's a matter of turning on "useFrameworks" in "static" mode in the Expo buildconfig, then adding the expo config plugins (if they exist) for each module you want. You'll need to have the google config plist / json files included somehow as an EAS build secret or something but...same for any cloud service API you use yes?

And...that ...should be it?

@VGerris
Copy link

VGerris commented Jan 8, 2025

@VGerris I believe in the Expo use case it's a matter of turning on "useFrameworks" in "static" mode in the Expo buildconfig, then adding the expo config plugins (if they exist) for each module you want. You'll need to have the google config plist / json files included somehow as an EAS build secret or something but...same for any cloud service API you use yes?

And...that ...should be it?

I am not entirely sure, I had all Google config in place and expected it to 'just work'. The Podfile is generated by Expo and I see now having a bit more understanding that I basically just need to add the config as you posted for the modules the error throws at building.

Without your post with example it would have been a lot harder to figure out, having practically zero experience with any part of the stack :).

In a recent build I needed :

pod 'FirebaseAuth', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'FirebaseAppCheckInterop', :modular_headers => true
pod 'FirebaseAuthInterop', :modular_headers => true
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'GTMSessionFetcher', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'RecaptchaInterop', :modular_headers => true

just before the post_install loop.

Regarding framework there is the following in the standard config, I didn't change anything else :

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']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report
Projects
None yet
Development

No branches or pull requests

4 participants