I was using VSCode to archive an ios .ipa. When I tried "flutter build ios --release", it failed with message: " Command PhaseScriptExecution failed with a nonzero exit code". I google this error and found many solutions, but none of them works for me. These solutions refer to "Key Chain Access","delete pods and clean build folder" and so on. I even update my MacOS system and 'XCode' to the newest version, but no miracle happens. Finally I found an useful command "flutter build ios --release -v" to show the detail info, here is the log on VSCode:
[ +6 ms] Encountered error while building for device.
[ +2 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:277:7)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:92:3)
<asynchronous suspension>
It seems like something wrong with my dart SDK, I'll be appreciate anyone helps me.
PS: This strange error only shows in my own MacBook Pro, it packages smoothly when I run the build command in my company's MacBook Pro.
you can try running the command:
flutter clean
rm -rf ios/Flutter/Flutter.framework
flutter build ios --release
OR uninstall flutter's SDK and try reinstall it again.