使用Xcode14+Google ML Kit构建iOS应用遇文件缺失错误求助
解决Google ML Kit示例工程构建文件缺失错误
可行的排查与修复步骤:
彻底清理并重建依赖与构建缓存
- 关闭Xcode,执行命令删除全局DerivedData缓存:
rm -rf ~/Library/Developer/Xcode/DerivedData - 回到工程根目录,执行
pod deintegrate && pod install重新集成CocoaPods依赖 - 重新打开
VisionWithRoomExample.xcworkspace,按下Cmd+Shift+K清理构建文件夹,再尝试重新构建
- 关闭Xcode,执行命令删除全局DerivedData缓存:
检查Target依赖关系与构建顺序
进入工程Target设置的Build Phases面板:- 确认
VisionWithRoomExampleObjCTarget已添加到主Target的Target Dependencies列表中,确保它优先于主Target完成构建 - 检查主Target是否有引用该ObjC Target产物的脚本或构建步骤,确认路径配置无误
- 确认
验证构建路径配置
- 打开Xcode偏好设置(
Cmd+,)>Locations,确认Derived Data设置为Custom且路径指向正确的工程目录 - 在工程Build Settings中搜索
Per-configuration Build Products Path,确保Debug/Release配置的路径为相对工作区的格式,比如$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
- 打开Xcode偏好设置(
检查自定义脚本的输出配置
若工程包含生成目标文件的自定义脚本:- 进入主Target的
Build Phases>Run Script步骤,确认脚本逻辑能正常生成VisionWithRoomExampleObjC文件 - 在脚本的
Output Files栏添加该文件的完整路径,让Xcode能够追踪到文件的生成状态
- 进入主Target的
错误原文:
error build: Build input file cannot be found: '/Users/Guilherme/Documents/VisionWithRoom/DerivedData/VisionWithRoomExample/Build/Products/Debug-iphoneos/VisionWithRoomExampleObjC.app/VisionWithRoomExampleObjC'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
内容的提问来源于stack exchange,提问作者Guilherme Barth
相关产品推荐
相关产品推荐

