Home > OS >  Flutter iOS build failed on real device with Command PhaseScriptExecution failed with a nonzero exit
Flutter iOS build failed on real device with Command PhaseScriptExecution failed with a nonzero exit

Time:11-18

So I am trying to run my app on an iOS device, and it always failed. It runs well on iOS Simulator and android but when I tried to run on iOS device, I got this error

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.

At first I thought that it was a problem with my flutter version, or package. But I made new app, run on device and still error. Always the Command PhaseScriptExecution failed with a nonzero exit code

I know that this one is already asked often, I opened so many threads here related to this error and tried almost everything I can find and still errors, sometimes the error details vary but all of them is phasescriptexecution.

Is there any solution to this?

CodePudding user response:

Your verbose log via flutter run -v contains this important line

Target debug_unpack_ios failed: Exception: Failed to codesign

So running the app fails because codesigning was not possible. There are many proposed solutions online about this error message (1, 2). Some of them are:

  • Delete the build directory
  • Run flutter clean

and then try to run the app again

  • Related