About Xcode command phasescriptexecution failed with a nonzero exit code solution

1. Problem description

USES Xcode for code writing, and the following error has been reported during the compilation process when the new project code is pulled down during project development.

Command PhaseScriptExecution failed with a nonzero exit code

after searching on the Internet, most of the solutions given on the Internet were as follows. However, after I tried, the problem was not solved, but more mistakes were reported. Therefore, I consulted my tutor again, and finally got the solution.

encountered this bug hint when running a project, which could not be compiled. This is actually a bug caused by Xcode10. Solution: Select File -&gt in Xcode menu bar; Workspace Setting -> Choose Legacy Build System to rerun.

The primary cause of

is that the workspace is full, leading to code compilation errors, and there are roughly two ways to solve this problem.

(1) enter the code working cache folder of Xcode to clean manually ( is error-prone, is not recommended)

(2) use only the cleaning method provided by Xcode directly. Xcode will automatically link the working file after cleaning the workspace ( will not make mistakes, is recommended)

because the second method is easier to work with and less likely to go wrong, we use this method directly in the solution.

ii. Solution

1. First in Product -> Scheme selects the main code module for the current project

2. Select Product -> Clean Build Folder Clean workspace

3. Recompile the project code after

Read More: