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

M1 Pro Mac仅Debug模式报错<FirebaseCore/FirebaseCore.h>文件找不到求助

解决M1 Mac下React Native Debug模式找不到FirebaseCore.h的问题

针对性修复方案:

1. 精准配置Podfile架构与模块化设置

修改Podfile,仅在Debug模式下适配M1架构,并强制Firebase模块开启模块化编译:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # 仅Debug模式下排除模拟器arm64架构
      if config.name == 'Debug'
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end
    # 给所有Firebase相关target开启模块化定义
    if target.name.start_with?('Firebase')
      target.build_configurations.each do |config|
        config.build_settings['DEFINES_MODULE'] = 'YES'
      end
    end
  end
end

执行命令重置Pods:

pod deintegrate && pod install

2. 修正Xcode Debug Scheme配置

打开Xcode的Scheme设置(Product > Scheme > Edit Scheme):

  • 切换到Run > Info标签页
  • 确认Build Configuration为Debug
  • 将Executable指定为你的App名称(不要选Ask On Launch)
  • 勾选Debug executable选项

3. 清理模拟器架构缓存

关闭Xcode和所有模拟器,执行以下命令清空模拟器缓存:

xcrun simctl shutdown all
xcrun simctl erase all

重启Xcode后执行Cmd + Shift + K清理Build Folder,再尝试Debug运行。

4. 检查主项目Header Search Paths

在主项目的Build Settings中找到Header Search Paths,Debug模式下添加:

  • $(SRCROOT)/Pods/FirebaseCore/FirebaseCore/Sources(勾选Recursive)
  • $(inherited)(确保继承Pods的默认头文件路径)

5. 用Rosetta模式运行Xcode

右键Launchpad中的Xcode图标 → Get Info,勾选Open using Rosetta,重启Xcode后再尝试Debug编译。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 07:05:34