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

Swift 5环境下使用FirebaseMLCommon无法在iOS模拟器运行应用

问题描述
  • 开发环境:Xcode Version 14.0.1 (14A400)、Mac OS Monterey 12.6
  • 引入的Pod依赖:
    pod 'Firebase/MLVision'
    pod 'Firebase/MLVisionTextModel'
  • 问题现象:应用在真机上运行正常,但模拟器编译时出现如下报错:

error build: In../Pods/FirebaseMLCommon/Frameworks/FirebaseMLCommon.framework/FirebaseMLCommon(aligned_new_bca0ac320467a2457b3e306bfed17856.o), building for iOS Simulator, but linking in object file built for iOS, file '/Volumes/Mydocument/Workspace/IOS/Runnig/bcbl-ios-app/Pods/FirebaseMLCommon/Frameworks/FirebaseMLCommon.framework/FirebaseMLCommon' for architecture arm64

解决方案

方法一:排除模拟器的arm64架构

  • 打开Xcode,选中项目根节点,进入Build Settings面板
  • 搜索Excluded Architectures,在Debug配置的iOS Simulator条目下添加arm64
  • 进入Pods项目的Build Settings,重复上述操作,确保Pod的Debug配置也排除了模拟器的arm64架构

方法二:更新Firebase相关Pod依赖

  • 终端执行命令更新依赖:
    pod update Firebase/MLVision Firebase/MLVisionTextModel
  • 更新完成后,使用Cmd+Shift+K清理项目,再重新编译

方法三:通过Podfile配置自动处理架构

在Podfile的末尾添加以下代码:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.name == 'Debug' && config.build_settings['SDKROOT'] == 'iphonesimulator'
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end
  end
end

执行pod install重新安装依赖后,再尝试编译模拟器

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.18 04:35:36