Xcode 13.3 build fails: Command EmitSwiftModule failed with a nonzero exit code

Viewed 11735

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?

5 Answers

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.

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

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

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.

Related