Build fails with “Command failed with a nonzero exit code”

前端 未结 30 2434
栀梦
栀梦 2020-11-28 09:15

When I try to build my app with Xcode, an error interrupts the build process:

Command CompileStoryboard failed with a nonzero exit code

相关标签:
30条回答
  • 2020-11-28 09:31

    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!!!

    0 讨论(0)
  • 2020-11-28 09:31

    I tried a lot of the options discussed here.

    • Delete and reinstall pods
    • Clean Build Folder
    • Delete Derived Data
    • Add SWIFT_ENABLE_BATCH_MODE and set its value to NO
    • Restarting Xcode and Recompiling
    • Restarting iMac and Recompiling
    • set Compilation Mode to Incremental
    • Changed build settings: SWIFT_COMPILATION_MODE = singlefile and SWIFT_OPTIMIZATION_LEVEL = "-O"

    Nothing worked. I'm using Xcode Version 11.0 beta (11M336w).

    Finally I downloaded a fresh copy and replaced the one I had previously installed. It was the same exact version. That did the trick.

    0 讨论(0)
  • 2020-11-28 09:33

    The targets should be specified with related data such as appicon

    0 讨论(0)
  • 2020-11-28 09:36

    When you stop building a project when the compiler is in the middle of something "important", this error could appear. In that case, building the project again and letting it finish normally makes this error disappear.

    0 讨论(0)
  • 2020-11-28 09:37

    I have faced similar problem. I have done

    • clean project - didn't work
    • Remove Derived Data Folder - didn't work
    • Change build system to Legacy Build Settings - didn't work
    • Restart XCode - didn't work
    • Comment some of my code, a typedef NS_ENUM in .h file and enums related works. Build the system and build success shown. Next un-comment the code and build again - Magically works
    0 讨论(0)
  • 2020-11-28 09:38

    In my case, I used too complicated initializations inside a class extension. It suddenly broke my build.

    class MyClass { }
    extension MyClass {
    static var  var1 = "", var2 = "", var3 = "", var4 = "", ...., var20 = ""
    }
    

    Resolved:

    class MyClass { }
        extension MyClass {
        static var var1 = "",
        static var var2 = "",
        static var var3 = ""
        static var var4 = "", ...., 
        static var var20 = ""
        }
    
    0 讨论(0)
提交回复
热议问题