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

Flutter iOS在Xcode归档时触发Command PhaseScriptExecution错误求助

Xcode归档失败:Command PhaseScriptExecution failed with a nonzero exit code(找不到device_info_plus.framework)

问题描述

在Xcode中点击Archive按钮时触发错误:Command PhaseScriptExecution failed with a nonzero exit code,应用可正常在模拟器和真机运行,但无法归档。完整错误日志:

building file list ... rsync: link_stat "/Users/sahinefe/Documents/Github/kafile-app/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/device_info_plus.framework" failed: No such file or directory (2)
done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/aaefcfd1-5c95-11ed-8734-2e32217d8374/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code

已尝试操作

  • 执行flutter clean、flutter pub get、flutter pub cache repair
  • 删除podfile.lock后执行pod install、pod update、pod repo update、pod reintegrate

可能的解决方法

1. 适配device_info_plus与Flutter版本

检查pubspec.yaml中device_info_plus的版本,确认是否与当前Flutter版本兼容。若版本不匹配,切换到官方推荐的稳定版本,执行:

flutter pub add device_info_plus:^[兼容稳定版本号]

2. 修正Xcode框架搜索路径

打开iOS项目的Runner.xcworkspace,选择Runner目标进入Build Settings,搜索FRAMEWORK_SEARCH_PATHS,确保$(BUILD_DIR)/UninstalledProducts/iphoneos被添加到列表中,并勾选recursive选项。

3. 清理Xcode构建缓存

关闭Xcode,执行以下命令删除Xcode的DerivedData缓存:

rm -rf ~/Library/Developer/Xcode/DerivedData

重新打开项目后尝试归档。

4. 重新生成iOS项目配置

在项目根目录执行:

flutter create --platforms ios .

重新生成iOS相关配置文件,之后依次执行flutter pub get和pod install。

5. 检查Podfile配置

打开iOS目录下的Podfile,确认没有针对device_info_plus的冲突配置。Flutter项目通常无需手动设置use_frameworks!,若存在该配置可尝试注释后重新执行pod install。

内容的提问来源于stack exchange,提问作者Alper Efe Sahin

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.20 19:37:11