Build fails with “Command failed with a nonzero ex

2020-01-24 22:45发布

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?

标签: xcode
30条回答
Deceive 欺骗
2楼-- · 2020-01-24 23:23

I also facing same issue in xcode 10 and tried all the solutions provided but nothing working.

Then I deleted all the files and folders of the following folder :

/Users/meenakrishna/Library/Developer/Xcode/DerivedData

and it worked like a charm.

查看更多
Rolldiameter
3楼-- · 2020-01-24 23:23

The targets should be specified with related data such as appicon

查看更多
甜甜的少女心
4楼-- · 2020-01-24 23:24

Since this issue looks to have dozens of possible solutions and the root cause could be very vague, I'll throw my situation into the ring. Half of my pods were failing with some sort of CompileSwiftSource failure, but only on archive. I was still able to build for device and simulator just fine. I tried a lot (if not all) of the solutions suggested here with no luck. One of the pods had a slightly different error before the CompileSwiftSource error so I went to updating and trying to fix that single pod. It was the Cache library for iOS which hadn't been updated in a while. There was a fork that resolved the issue with updating to Xcode 10.2 that I was able to update to and after that, all of the other issues took care of themselves. So look for a single outlier in your pods if you're getting a bunch of them erroring out and start there.

查看更多
Summer. ? 凉城
5楼-- · 2020-01-24 23:24

Alright, I was having the same problem with Xcode 10. I usually use a storyboard for every view, that way if someone is helping it's easier to fold code in. I needed to make one of the view on one storyboard the initial view Controller.

查看更多
Emotional °昔
6楼-- · 2020-01-24 23:25

Closing Xcode for me didn't have an effect. Instead, I cleaned the project using CommandShiftK.


I also found another reason: I had a storyboard reference to another storyboard which I had removed. The quick fix was deleting this.

enter image description here

查看更多
我命由我不由天
7楼-- · 2020-01-24 23:26

Command CompileSwift failed with a nonzero exit code

This error happens when you are migrating your code from Xcode 9 to Xcode 10+. It due to any class name is conflicting with existing apple classes. For Example: State, Event etc.

  1. So first change the class/structure name if any existing in your code like "State" to "StateDetail"

  2. If Info.plist is added in target, remove tick mark from it so it will not copy app bundle (Latest Xcode10 security reason).

    • Select Info.plist file and uncheck under "Target Membership" in right side Identity inspector

And build code again!!!

查看更多
登录 后发表回答