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

M1设备arm64架构问题:无法运行旧React Native项目

解决M1设备上React Native 0.63.3 + Xcode14.2的OpenSSL架构链接错误

核心问题:你使用的OpenSSL-Universal静态库仅包含iOS真机的arm64架构,缺少iOS模拟器的arm64架构编译产物,导致Xcode14.2编译模拟器版本时链接失败。以下是针对性解决方案:

步骤1:替换兼容的OpenSSL-Universal版本

进入项目的ios目录,修改Podfile,将原有的OpenSSL-Universal依赖替换为支持模拟器arm64的分支版本:

# 替换原有的pod 'OpenSSL-Universal'为如下内容
pod 'OpenSSL-Universal', :git => 'https://github.com/krzyzanowskim/OpenSSL.git', :tag => '1.1.1100'

执行以下命令重新安装依赖:

pod deintegrate
pod install

步骤2:调整项目Build Settings配置

打开Xcode,选中项目根节点,进入Build Settings面板:

  • 找到Excluded Architectures,在Debug配置的Any iOS Simulator SDK项中添加arm64(仅针对模拟器排除该架构,不要全局排除)
  • 找到Valid Architectures,确保值为arm64 x86_64
  • 找到Build Active Architecture Only,将Debug设为YES,Release设为NO

步骤3:添加Pod架构兼容脚本

在Podfile末尾添加post_install脚本,强制所有Pod适配模拟器架构:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # 仅对模拟器排除arm64
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      config.build_settings['VALID_ARCHS'] = 'arm64 x86_64'
      # 适配旧RN版本的最低部署要求
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
    end
  end
end

再次执行pod install使配置生效。

步骤4:清理缓存并重建

执行命令清理Xcode缓存:

rm -rf ~/Library/Developer/Xcode/DerivedData

在Xcode中按下Cmd+Shift+K清理项目,然后重新编译模拟器版本。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.07 13:35:15