升级Xcode 14后Flutter iOS项目无法运行:缺失project.pbxproj文件
解决Xcode 14升级后Flutter项目iOS端无法运行的问题
报错信息
Unable to get Xcode project information:
2022-12-01 13:57:05.376 xcodebuild[71564:226197] Writing error result bundle to
/var/folders/6g/w7cqd0s54c33_20mrl4v2q640000gn/T/ResultBundle_2022-01-12_13-57-0005.xcresult
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
Reason: Project /Users/noel/Treegar/treegar-app/ios/Runner.xcodeproj cannot be opened because it is missing its
project.pbxproj file.
解决方案
1. 检查并恢复缺失的文件
前往项目路径 /Users/noel/Treegar/treegar-app/ios/Runner.xcodeproj/,确认project.pbxproj文件状态:
- 若文件丢失,优先从项目版本控制(如Git)历史中恢复该文件;
- 无版本记录的话,尝试从本地备份或共享存储中找回。
2. 重新生成iOS项目结构
恢复文件无效时,可通过Flutter命令重建iOS端项目:
- 先备份项目中的
ios文件夹,保存自定义配置(如签名信息、Info.plist修改内容); - 在项目根目录执行命令:
flutter create --platforms ios . - 将备份的自定义配置迁移到新生成的
ios文件夹中。
3. 清理缓存并重装依赖
- 清理Flutter缓存:
flutter clean - 进入
ios目录,清理CocoaPods缓存并重新安装:cd ios pod deintegrate pod cache clean --all pod install - 打开Xcode,执行
Product > Clean Build Folder(快捷键Cmd+Shift+K)清理构建缓存。
4. 验证Xcode项目配置
重新打开Runner.xcodeproj,确认:
- Bundle Identifier、签名证书配置正确;
Build Settings中的Deployment Target等基础配置与项目需求匹配。
内容的提问来源于stack exchange,提问作者Noel
相关产品推荐
相关产品推荐

