简体   繁体   中英

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

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?

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

在此处输入图像描述

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

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.

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

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM