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

Intel芯片Mac运行react-native run-ios时RCT-Folly编译失败求助

解决方案:Intel Mac + RN 0.70.6 + Xcode 15 下 RCT-Folly 编译失败修复

步骤1:修改 RCT-Folly 编译配置

在iOS项目的Podfile末尾添加以下配置,适配Xcode15的clang编译规则:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'RCT-Folly'
      target.build_configurations.each do |config|
        # 指定C++17标准,适配Xcode15编译器
        config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
        config.build_settings['CLANG_CXX_LIBRARY'] = 'libc++'
        # 关闭Xcode15新增的严格编译报错
        config.build_settings['OTHER_CFLAGS'] ||= []
        config.build_settings['OTHER_CFLAGS'] << '-Wno-error=unused-command-line-argument-hard-error-in-future'
      end
    end
  end
end

步骤2:彻底清理缓存并重装依赖

依次执行以下命令:

# 清理React Native缓存
npx react-native clean

# 进入iOS目录清理Pod相关文件
cd ios && rm -rf Pods Podfile.lock

# 清理Xcode衍生数据(也可通过Xcode菜单:Product -> Clean Build Folder 完成)
rm -rf ~/Library/Developer/Xcode/DerivedData

# 重新安装Pods
pod install

步骤3:调整Xcode项目架构设置

  1. 打开iOS项目的.xcworkspace文件
  2. 选中项目根节点,切换到Build Settings标签:
    • 将Architectures设置为Standard Architectures (x86_64, arm64) - $(ARCHS_STANDARD)
    • 在Excluded Architectures的Debug-iphonesimulator项中添加arm64(Intel芯片模拟器无需该架构)

步骤4:重新启动项目

回到项目根目录执行:

npx react-native run-ios

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.09 15:09:55