You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode无法构建模块:React Native集成Firebase编译报错求助

React Native集成Firebase后iOS构建失败,多个模块无法编译

我是移动端开发新手,在React Native项目中集成Firebase后,iOS构建时出现多个模块无法编译的问题,以下是相关信息:

相关信息

  • 失败模块截图:多个Firebase及关联模块(如FirebaseCore、GoogleUtilities、FirebaseCoreInternal等)显示编译失败
  • 错误日志示例:报错内容包含头文件引用找不到、模块编译失败等类型的错误
  • 当前Podfile内容:
# 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, '13.4'
prepare_react_native_project!

# Include ReactCommon dependencies
pod 'ReactCommon', :path => '../node_modules/react-native/ReactCommon'
pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'

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

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

  # Apply modular headers only to specific Firebase-related pods
  pod 'FirebaseCore', :modular_headers => true
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

  target 'CampusWatchTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(installer, config[:reactNativePath])

    # Optionally, handle ReactCommon modulemap conflicts
    # system("rm -rf Pods/Target\ Support\ Files/ReactCommon/ReactCommon.modulemap")
  end
end

已尝试的解决方法

  • 修改项目及目标Target的Header Search Paths和Library Search Path配置
  • 在Build Phases的「Link Binary With Libraries」中添加相关框架
  • 按ChatGPT建议调整上述配置后,问题仍未解决,恳请帮助!

内容的提问来源于stack exchange,提问作者shell

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 12:17:23