简体   繁体   English

Xcode 13.3 构建失败:命令 EmitSwiftModule 失败,退出代码非零

[英]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.升级到 Xcode 13.3 后,由于出现错误,项目不再构建:命令 EmitSwiftModule 失败,退出代码非零。

Does anyone know what the problem could be?有谁知道是什么问题? There're only warnings about using AnyObject instead of class in the protocols.协议中只有关于使用AnyObject而不是class的警告。 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.但问题到底出在哪里——尚不清楚,因为 Xcode 甚至没有暗示。 Are there any ways to localize the error?有什么方法可以定位错误?

Remove @UIApplicationMain on the code, it worked for me.删除代码上的@UIApplicationMain,它对我有用。 I reckon this firebase bug is associated with Xcode 13.3我认为这个 firebase 错误与 Xcode 13.3 相关

Edit: Changed @main to @UIApplicationMain.编辑:将@main 更改为@UIApplicationMain。

Problem could be with one of your libraries/pods which needs to be updated .问题可能出在您需要更新的库/pod 之一。

You could export Failed Build Logs from Xcode Report Navigator - Export Log您可以从 Xcode Report Navigator 导出失败的构建日志 - 导出日志

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.在我的情况下,我必须更新我按照以下步骤操作的 Pod。

1)Run pod deintegrate 1) 运行 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 2)在 pod 文件中提及更新的 pod 版本,或者您可以简单地删除提到的任何显式版本以获得最新的 pod 版本

In my case I updated pod version as " pod 'CryptoSwift', '~> 1.4.0' "就我而言,我将 pod 版本更新为“ pod 'CryptoSwift', '~> 1.4.0' ”

3)Run pod install. 3)运行吊舱安装。

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. *** 我附上了日志结尾的屏幕截图示例,其中在构建失败消息之前提到了我的受影响 pod。 Hope it helps anyone ***希望它可以帮助任何人***

在此处输入图像描述

Please update your Apollo SPM to Version 0.51.0 to get this issue resolved.请将您的 Apollo SPM 更新到版本 0.51.0 以解决此问题。

https://github.com/apollographql/apollo-ios/releases/tag/0.51.0 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.过了一会儿,我发现问题在于使用Self.Body作为 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.由于某种原因,Swift 无法编译该类。 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.就我而言,此问题发生在复制 class 时。 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.对我来说,问题是我在 UIViewController 扩展以及视图控制器中声明了相同的 function 名称。 Once I rename the function name in View Controllers this issue got fixed.一旦我在视图控制器中重命名 function 名称,这个问题就得到了解决。 Thanks!!谢谢!!

https://i.stack.imgur.com/M0fej.png [Wrong Way] https://i.stack.imgur.com/M0fej.png [错误方式]

https://i.stack.imgur.com/VI3Ts.png [Correct Way] https://i.stack.imgur.com/VI3Ts.png [正确方式]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode 10 构建失败,“命令 CompileSwift 失败,退出代码为非零” - Xcode 10 build fails with 'Command CompileSwift failed with a nonzero exit code NativeScript iOS 构建失败 Xcode - 错误:命令 Ld 失败,退出代码非零 - NativeScript iOS Build Fails Xcode - Error: Command Ld failed with a nonzero exit code Xcode 11.6 失败:命令 PhaseScriptExecution 失败,退出代码为非零 - Xcode 11.6 fails with: Command PhaseScriptExecution failed with a nonzero exit code "构建失败并显示“命令 PrecompileSwiftBridgingHeader 失败,退出代码为非零”" - Build fails with "Command PrecompileSwiftBridgingHeader failed with a nonzero exit code" xcode 命令 PhaseScriptExecution 失败,退出代码为非零 - xcode Command PhaseScriptExecution failed with a nonzero exit code 命令 PhaseScriptExecution 因 Xcode 中的非零退出代码而失败 - Command PhaseScriptExecution failed with a nonzero exit code in Xcode Xcode 12.4 React 本机构建在 IOS 中失败显示所有消息命令 PhaseScriptExecution 因非零退出代码而失败 - Xcode 12.4 React native build failed in IOS Showing All Messages Command PhaseScriptExecution failed with a nonzero exit code 如何修复出现在 Xcode 11.3.1 中的此构建时间错误 - 命令 CompileSwiftSources 失败,退出代码为非零 - How can I fix this build time error appearing in Xcode 11.3.1 - Command CompileSwiftSources failed with a nonzero exit code 构建时在 xcode 中出错 - PhaseScriptExecution 失败,退出代码非零 - Getting error in xcode while build - PhaseScriptExecution failed with a nonzero exit code Xcode 11.2.1 错误:命令 CompileSwiftSources 失败,退出代码非零 - Xcode 11.2.1 error: Command CompileSwiftSources failed with a nonzero exit code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM