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

Xcode 12.2+React Native 0.65 iOS构建失败 报x86_64架构重复符号错误求解决

修复方案

核心原因

React Native 0.60及以上版本默认支持自动链接(Autolinking),你在Podfile中手动声明的RN第三方库已经被自动引入,重复声明导致链接阶段出现重复符号报错。同时你的Podfile中存在冗余错误字符,也会引发依赖解析异常。

操作步骤

  • 修正Podfile内容
    1. 删除第二行末尾多余的enter image description here错误字符串
    2. 删除所有RN相关第三方库的手动pod声明,仅保留原生依赖JWT的声明即可,Autolinking会自动识别node_modules中的RN依赖无需手动配置。修正后Podfile参考:
    require_relative '../node_modules/react-native/scripts/react_native_pods'
    require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
    require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
    
    platform :ios, '11.0'
    
    target 'dhenusya' do
    use_unimodules!
    config = use_native_modules!
    
    use_react_native!(:path => config["reactNativePath"])
    
    pod 'JWT', '3.0.0-beta.12'
    
    end
    
  • 清理缓存重装依赖
    1. 项目根目录执行命令重装node依赖:
      rm -rf node_modules && yarn install
    2. 进入iOS目录清理旧Pod资源:
      cd ios && rm -rf Pods Podfile.lock
    3. 清理Xcode全局缓存:
      rm -rf ~/Library/Developer/Xcode/DerivedData/*
    4. 重新安装Pod依赖:
      pod install
  • Xcode编译调整
    1. 打开项目必须使用.xcworkspace后缀的文件,禁止使用.xcodeproj文件打开
    2. 进入项目Build Settings,找到Excluded Architectures配置项,为Debug模式添加arm64,适配x86_64架构模拟器编译
    3. 点击Xcode顶部菜单栏Product -> Clean Build Folder清空编译缓存后重新运行项目

若执行完上述步骤仍有报错,可查看Xcode报错详情中具体重复的7个符号,定位对应依赖后单独处理即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.02 06:09:04