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

Unity开发AR应用Xcode编译报错:未找到ARCoreBase.xcframework

解决Xcode编译ARCore应用时找不到ARCoreBase.xcframework的问题

问题场景

  • 使用Unity 2021.3.27f1结合Google ARCore Geospatial API开发AR应用,Unity端编译无报错
  • 导出Xcode工程后,在iPad上编译触发以下错误:
    • Framework not found ARCoreBase.xcframework
    • linker command failed with exit code 1 (use -v to see invocation)
  • 开发环境:Xcode 14.3.1、Mac mini(M2Pro) macOS Ventura 13.4.1
  • 已尝试操作:安装pods、打开.xcworkspace、更新Unity包,问题未解决;推测Podfile未包含ARCore/Base依赖是核心原因

解决方案

1. 补充Podfile中的ARCore基础依赖

你的Podfile确实缺少了ARCore的基础组件依赖,需将ARCore/Base添加到UnityFramework目标中,修改后的Podfile内容如下:

source 'https://cdn.cocoapods.org/'
platform: ios, '12.0'
target 'UnityFramework' do
  pod 'ARCore/Base', '~> 1.37.0'
  pod 'ARCore/GARSession', '~> 1.37.0'
  pod 'ARCore/Geospatial', '~> 1.37.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

修改完成后,在Xcode工程根目录执行以下命令更新依赖:

pod install --repo-update

2. 校验Unity端ARCore配置

  • 打开Unity编辑器,进入Project Settings > XR Plug-in Management > ARCore,确认Geospatial选项已勾选
  • 检查Player Settings > Other Settings中的Target Minimum iOS Version是否设置为12.0或更高,需与Podfile中的版本一致
  • 重新导出Xcode工程,避免导出过程中遗漏必要文件

3. 清理Xcode缓存与构建残留

  • 关闭Xcode,删除工程目录下的DerivedData文件夹(可通过Xcode > Preferences > Locations查看并定位该路径)
  • 在Xcode中执行Product > Clean Build Folder(快捷键Shift+Command+K)
  • 重新打开.xcworkspace文件后尝试编译

4. 确认ARCoreBase.xcframework是否存在

  • 打开Podfile所在目录的Pods/ARCore文件夹,检查ARCoreBase.xcframework是否存在
  • 若文件缺失,执行pod deintegrate移除现有pod依赖,再重新执行pod install完成全量安装

5. 检查Xcode的Framework搜索路径

  • 在Xcode中选中UnityFramework目标,进入Build Settings页面
  • 搜索Framework Search Paths,确保包含$(PROJECT_DIR)/Pods/ARCore路径,并设置为recursive
  • 若路径缺失,手动添加该路径后重新编译

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 03:37:40