1

Our React Native project was built using RN CLI and is on version 0.71.6. I am using XCode v16.1, and my Mac OS is Sequoia 15.5.

I am able to build for Android just fine, but when it comes to iOS I consistently get an error related to dependencies in DerivedData/module_map not being found. I am trying to run my app in an iOS simulator on my machine called iPhone 16 Plus. I've tried other simulators as well. It seems to be something related to Firebase.

/Users/mattcroak/Development/firefly-mobile/ios/FireflyMobile/main.m module map file '/Users/mattcroak/Library/Developer/Xcode/DerivedData/MyApp-crdglybzvgexvscaguhxbncunctu/Build/Products/Debug-iphonesimulator/FirebaseCoreInternal/FirebaseCoreInternal.modulemap' not found

When I try to navigate to that directory, I only see my app name and the below icon.

enter image description here

Running pod install doesn't throw any errors. I confirmed in my terminal that I can see

Installing Firebase (10.20.0)
Installing FirebaseAppDistribution (10.20.0-beta)
Installing FirebaseCore (10.20.0)
Installing FirebaseCoreExtension (10.20.0)
Installing FirebaseCoreInternal (10.29.0)
Installing FirebaseCrashlytics (10.20.0)
Installing FirebaseInstallations (10.29.0)
Installing FirebaseSessions (10.29.0)

This happens when I try to run the command via the command line or when I open the project in Xcode, select the correct simulator and then try to build. yarn iosDev --simulator="iPhone 16 Plus"

Which basically executes the below.

react-native run-ios --scheme 'MyApp-Dev' --mode 'Debug' '--simulator=iPhone 16 Plus'

What I've tried

  • I've explored solutions found here and here.
  • I've excluded arm64 architecture as I am on an older RN version.
  • I’ve also tried updating HEADER_SEARCH_PATHS to explicitly reference different PODS.
  • I am opening .xcworkspace, not accidentally opening the project file.
  • Tried using npx react-native run-ios and the run it on Xcode instead of yarn iosDev.
  • Cleared cache, deleted derived data, deintegrated pods, removed pods, podfile.lock, build folder, and re-run pod install (and pod install —repo-update).

What's peculiar is that this is working for other developers who are running the latest Sequoia and Xcode version 16.1. I've tried quite a few things and worked with them to see what I might be missing but it seems to be consistent with what they're using.

In a perfect world we'd be using Expo or at least a new RN version but we're on a time crunch for releasing so ideally I could get this working for me on iOS just to get us to the release and then we work on migrating. I'd also like to go this route because it's working for the rest of the team and I can still run it on Android. I feel like I'm just missing something small here but I'm not sure where else to look.

Below is my Podfile.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
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,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
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 'MyApp' do
  config = use_native_modules!

    # Flags change depending on the env values.
  flags = get_default_flags()
  
  pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
  pod 'react-native-flipper', path: '../node_modules/react-native-flipper'
  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'react-native-blob-util',
    :path => '../node_modules/react-native-blob-util'

  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :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 'MyApp-Dev' do
    inherit! :complete
    # Pods for testing
  end

  target 'MyApp-Stage' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
      framework_path = File.join(Dir.pwd, framework_relative_path)
      command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
      puts "Stripping bitcode: #{command}"
      system(command)
    end

    framework_paths = [
      "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
      "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
    ]

    framework_paths.each do |framework_relative_path|
      strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    end
  end
end

2 Answers 2

0

Open the file ./ios/Podfile And add these lines inside your targets (right before the use_react_native line in current react-native:

use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true

Also, if you have flipper_configuration Then, commented it out, disable flipper at all.

If it still does not work, check all iOS setup steps carefully from the official doc, https://rnfirebase.io/#configure-firebase-with-ios-credentials-react-native--077

Check below podfile:
try it once.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
prepare_react_native_project!

# ✅ Required for Firebase
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true

target 'MyApp' do
  config = use_native_modules!
  flags = get_default_flags()

  # ✅ Firebase dependencies
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'FirebaseAppDistribution', :modular_headers => true
  pod 'FirebaseCrashlytics', :modular_headers => true
  pod 'FirebaseSessions', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'nanopb', :modular_headers => true

  # ✅ Other native modules
  pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'react-native-blob-util', :path => '../node_modules/react-native-blob-util'
  pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
  pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'

  # ❌ Removed Flipper support completely
  # pod 'react-native-flipper', path: '../node_modules/react-native-flipper'
  # flipper_config = FlipperConfiguration.disabled

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # ❌ Do not pass :flipper_configuration at all
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyApp-Dev' do
    inherit! :complete
  end

  target 'MyApp-Stage' do
    inherit! :complete
  end

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end

    react_native_post_install(
      installer,
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    bitcode_strip_path = `xcrun --find bitcode_strip`.chomp
    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
      framework_path = File.join(Dir.pwd, framework_relative_path)
      command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
      puts "Stripping bitcode: #{command}"
      system(command)
    end

    framework_paths = [
      "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
      "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes"
    ]

    framework_paths.each do |framework_relative_path|
      strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    end
  end
end



# 1. Clean everything
rm -rf ios/Pods ios/Podfile.lock ~/Library/Developer/Xcode/DerivedData

# 2. Install pods again
cd ios && pod install --repo-update
Sign up to request clarification or add additional context in comments.

Comments

0

I solved this issue by adding -

1 . source 'https://github.com/CocoaPods/Specs.git' # Use the GitHub spec repo to avoid CDN issues
2. also add 'use_modular_headers!' # so I did not need to mention all file 'modular_headers => true'

NOTE - if it does not work first time then

Cleared cache, deleted derived data, deintegrated pods, removed pods, podfile.lock, build folder, and re-run pod install (and pod install —repo-update).

then build again.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
prepare_react_native_project!

# Use the GitHub spec repo to avoid CDN issues
source 'https://github.com/CocoaPods/Specs.git'

# 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,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
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

use_modular_headers!

target 'MyApp' do
  config = use_native_modules!

    # Flags change depending on the env values.
  flags = get_default_flags()
  
  pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
  pod 'react-native-flipper', path: '../node_modules/react-native-flipper'
  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
  pod 'Firebase'
  pod 'FirebaseCore'
  pod 'FirebaseCoreInternal'
  pod 'FirebaseCoreExtension'
  pod 'FirebaseInstallations'
  pod 'GoogleDataTransport'
  pod 'nanopb'
  pod 'GoogleUtilities'
  pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'react-native-blob-util',
    :path => '../node_modules/react-native-blob-util'

  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :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 'MyApp-Dev' do
    inherit! :complete
    # Pods for testing
  end

  target 'MyApp-Stage' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
    def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
      framework_path = File.join(Dir.pwd, framework_relative_path)
      command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
      puts "Stripping bitcode: #{command}"
      system(command)
    end

    framework_paths = [
      "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
      "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
      "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
    ]

    framework_paths.each do |framework_relative_path|
      strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    end
  end
end

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.