skip to Main Content

After upgrading to Xcode 13.3 the project no longer builds due error: Command EmitSwiftModule failed with a nonzero exit code.

Does anyone know what the problem could be? There’re only warnings about using AnyObject instead of class in the protocols. I guess the problem is in some library. But where exactly the problem is — it’s not clear, because Xcode does’t even hint about it. Are there any ways to localize the error?

7

Answers


  1. Chosen as BEST ANSWER

    Well, after digging in the logs, I found that there was a problem with the initializer. Swift couldn't compile the class for some reason. I don't know why there was no problem before, nevertheless the problem is fixed and the project is building. Conclusion: read the logs in detail.


  2. Remove @UIApplicationMain on the code, it worked for me. I reckon this firebase bug is associated with Xcode 13.3

    Edit: Changed @main to @UIApplicationMain.

    Login or Signup to reply.
  3. Please update your Apollo SPM to Version 0.51.0 to get this issue resolved.

    https://github.com/apollographql/apollo-ios/releases/tag/0.51.0

    Login or Signup to reply.
  4. Problem could be with one of your libraries/pods which needs to be updated .

    You could export Failed Build Logs from Xcode Report Navigator – Export Log

    These Logs could be valuable to check these type of unknown build failure issues where we are not sure of what library/file is actually impacting build process.

    Usually the libraries impacting the build will be found towards end of logs. In my case I had to update an Pod for which I followed below steps.

    1)Run pod deintegrate

    2)Inside pod file mention updated pod version or you can simply remove any explicit version which is mentioned to get latest pod version

    In my case I updated pod version as " pod ‘CryptoSwift’, ‘~> 1.4.0’ "

    3)Run pod install.

    Everything should work well after that.

    *** I have attached screenshot sample of end of logs where my impacted pod was mentioned before build failure message. Hope it helps anyone ***

    enter image description here

    Login or Signup to reply.
  5. I had the same error in a project. After a while I found out that the problem was using Self.Body as a type in SwiftUI. After removing that the project could build again

    Login or Signup to reply.
  6. In my case, this issue happened when a class was duplicated.
    Try to review the merge in detail.

    Login or Signup to reply.
  7. for me the issue was I declared same function names in UIViewController Extension as well as in the View Controllers. Once I rename the function name in View Controllers this issue got fixed.
    Thanks!!

    https://i.stack.imgur.com/M0fej.png [Wrong Way]

    https://i.stack.imgur.com/VI3Ts.png [Correct Way]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search