When I try to build my app with Xcode, an error interrupts the build process:
Command
CompileStoryboard
failed with a nonzero exit code
Sometimes, it shows this error instead:
Command
CompileSwift
failed with a nonzero exit code
I have New Build System turned on.
What can I do to fix this?
What helped to me is to set
Compilation Mode
toIncremental
for all configurations inTarget's Build Settings
. WithWhole module
compilation mode I got errors. But this setting made project build slower.Switching to the legacy build system fixed the issue for me
If you have multiple targets, where two or more targets have files with the same name, check the target membership of those files in Files inspector. The error occurs when multiple instances of the equally named file have set the target membership for the same target.
I had the error
Command LinkStoryboards failed with a nonzero exit code
, and found that I was using an external storyboard reference to a non-existent storyboard. I had recently changed the name of a storyboard file, so changing the reference from the 'old' name to the 'new' name solved it for me.You may not have exactly the same error as me, but an easy way to find a more detailed explanation of the error is to:
I hope this helps. Please, I am aware that I am answering from experience of a different error than this question was asked about, but I believe this advice should help you conquer similar problems!
I had the same error Restarting Xcode and Recompiling Fixed the issue for me.
In my case, I used too complicated initializations inside a class extension. It suddenly broke my build.
Resolved: