Flutter iOS构建在真实设备上失败,Command PhaseScriptExecution失败,退出代码为非零



所以我试着在iOS设备上运行我的应用程序,它总是失败。它在iOS模拟器和android上运行良好,但当我试图在iOS设备上运行时,我得到了这个错误

Xcode build done.                                           10.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
Writing result bundle at path:
/var/folders/nw/p6_0x66x1t75x7mxp2f845_r0000gn/T/flutter_tools.scHoCB/flutter_ios_build_temp_dirncj4Fb/temporary_xcresult_bundle

Failed to package .../Testing/testing_app.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add
output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in
target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either
add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in
target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/nw/p6_0x66x1t75x7mxp2f845_r0000gn/T/flutter_tools.scHoCB/flutter_ios_build_temp_dirncj4Fb/temporary_xcresult_bundle

Could not build the precompiled application for the device.

一开始我以为是我的flutter版本或软件包出了问题。但我制作了新的应用程序,在设备上运行,仍然出错。总是Command PhaseScriptExecution failed with a nonzero exit code

我知道这个已经经常被问到,我在这里打开了很多与这个错误相关的线程,并尝试了几乎所有我能找到的错误,有时错误细节各不相同,但所有这些都是phasescriptexecution。

有什么解决办法吗?

通过flutter run -v的详细日志包含以下重要行

Target debug_unpack_ios failed: Exception: Failed to codesign

所以运行应用程序失败,因为协同设计是不可能的。关于这个错误消息(1,2),网上有很多解决方案。其中一些是:

  • 删除build目录
  • 运行flutter clean

,然后尝试再次运行应用程序

最新更新