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

升级Xcode 14.3后React Native无法在iOS模拟器运行求助

Xcode 14.3 升级后 React Native iOS 模拟器运行报错解决方案

问题说明

升级Xcode 14.3后,React Native项目可正常完成archive构建,但iOS模拟器启动时报错:

Building for iOS Simulator, but linking in object file built for iOS, file '/ios/Pods/GooglePlaces/Frameworks/GooglePlaces.framework/GooglePlaces' for architecture arm64

本质是模拟器构建时引入了仅支持iOS真机的arm64架构框架,导致架构不匹配。


解决方法

方法1:修改Podfile配置

在项目的ios/Podfile中添加针对GooglePlaces的架构排除规则,确保模拟器构建时跳过arm64:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # 为GooglePlaces设置模拟器排除arm64
    if target.name == 'GooglePlaces'
      target.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end
    # 保留原有React Native的post_install配置
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

修改后执行命令重新安装依赖:

cd ios && pod install && cd ..

方法2:手动修改Xcode项目架构设置

  1. 打开ios目录下的.xcworkspace文件
  2. 选中项目主Target,进入Build Settings,搜索Excluded Architectures
  3. 在Debug - Any iOS Simulator SDK中添加arm64
  4. 同样找到Pods项目下的GooglePlaces Target,重复上述步骤,确保模拟器架构排除arm64
  5. 清理项目(Cmd+Shift+K)后重新构建

方法3:关闭Xcode的Rosetta模式(仅M系列芯片Mac)

  1. 右键应用程序中的Xcode图标,选择「显示简介」
  2. 取消勾选「使用Rosetta打开」
  3. 重启Xcode后重新构建项目

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 14:53:15