Xcode 中的 gRPC 库出现 "Control may reach the end of non-void function" 错误

I'm getting a "Control may reach the end of non-void function" error with the gRPC library in Xcode

当我通过 Cocoapods 安装一个包含 gRPC 库作为依赖项的库时,我在 Xcode 中安装了一堆 "Control may reach the end of non-void function" 错误。这是怎么回事?我该如何解决?

发生这种情况的原因可能是 gRPC 库使用一些宏 return 编译器似乎无法理解的函数。

这没什么大不了的,除了出于某种原因,当 Cocoapods 安装包含 gRPC 的 pod 时,它将 Mismatched return type 值设置为 Yes (treat as error) 而不是 Yes.

您可以通过打开 XCWorkspace 中的 Pods 项目来解决此问题,在其中找到各种 gRPC* 目标,转到 构建设置 并搜索 不匹配 return 类型 。如果出于某种原因将其设置为 Yes (treat as error),则将值设置为 YesNo,然后您的项目应该可以正常构建。

潜在的 gRPC 问题已在最新的 gRPC 版本中得到解决。做一个 pod update 并确保你看到:

Installing gRPC 1.6.5 (was 1.6.0)
Installing gRPC-Core 1.6.5 (was 1.6.0)
Installing gRPC-ProtoRPC 1.6.5 (was 1.6.0)
Installing gRPC-RxLibrary 1.6.5 (was 1.6.0)