DEV Community

Vasilis Papagrigoriou
Vasilis Papagrigoriou

Posted on

Help to connect firebase auth to react-native project

React Native iOS Build Issue: 'FirebaseAuth/FirebaseAuth-Swift.h' file not found

Problem:

I keep encountering this error during the iOS build:

/ios/Pods/Headers/Private/Firebase/Firebase.h:40:15: fatal error: 'FirebaseAuth/FirebaseAuth-Swift.h' file not found

required ios: 17.0+

Steps I’ve Already Tried:

1. Cleaning Pods

  • Deleted Podfile.lock.
  • Ran pod install --repo-update to ensure dependencies are updated.

2. Cleaning Xcode Project

  • Deleted Derived Data.
  • Cleaned the build folder in Xcode.

3. Podfile Setup

I’m using use_modular_headers! instead of use_frameworks! because use_frameworks! creates conflicts with React Native. Here’s my Podfile:

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!

use_modular_headers!  # Using modular headers to resolve static library issues.

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 'mbn_ios' do
  config = use_native_modules!

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseAuth', :modular_headers => true

  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'mbn_iosTests' do
    inherit! :complete
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
    )
  end
end
Enter fullscreen mode Exit fullscreen mode

4. React Native Firebase

Installed the following dependencies:

  • @react-native-firebase/app
  • @react-native-firebase/auth

5. FirebaseAuth Directory Check

I noticed the following directory exists:

  • ios/Pods/FirebaseAuth/FirebaseAuth/

But it seems the FirebaseAuth-Swift.h file is still not being found.

Top comments (0)