ios - Swift iOS 14 Firebase 警告——这个旧式函数定义之前没有原型(prototype)

标签 ios swift firebase google-analytics-firebase

我有一个与 Firebase 集成的应用程序,可以使用 cocoapods 连接分析。它在 iOS 13 上运行良好,没有任何黄色警告,但是当我为目标 iOS 14 安装新的 cocoa pod 并构建应用程序时,我收到 6 条黄色警告消息
“XXXPods/GoogleUtilities/GoogleUtilities/Logger/GULLogger.m:130:20:这个旧式函数定义之前没有原型(prototype)”
GULLogger.m Warnings
当我在网上寻找答案时,只有少数人指着 Flutter。我没有这个应用程序的 Flutter,我认为我不需要它。有没有其他人有同样的问题?请如何为 iOS 14 静音?
我可以将 pod 降级到 iOS 13,但重点是更新版本。
感谢您的任何帮助/指导

最佳答案

所以这是 中的新警告Xcode 12.5 (我相信)用于在这些 SDK 中声明的旧 C 风格函数或使用该语法的任何旧风格代码。

这是什么意思?
do-not-leave-the-parameter-list-of-a-function-blank---use-void

if a function declaration does not include arguments, as in double atof();, that too is taken to mean that nothing is to be assumed about the arguments of atof; all parameter checking is turned off. This special meaning of the empty argument list is intended to permit older C programs to compile with new compilers. But it's a bad idea to use it with new programs. If the function takes arguments, declare them; if it takes no arguments, use void.

So this is how your function prototype should look:

int foo(void);

And this is how the function definition should be:

int foo(void)
{
    ...
    <statements>
    ...
    return 1;
}

One advantage of using the above, over int foo() type of declaration (ie. without using the keyword void), is that the compiler can detect the error if you call your function using an erroneous statement like foo(42). This kind of a function call statement would not cause any errors if you leave the parameter list blank. The error would pass silently, undetected and the code would still execute.



我们可以做什么?
可能会为 Firebase SDK 提出一张票来解决(如果还没有的话)。

这是多大的问题?
取决于实现细节。可能就像更换 () 一样简单与 (void)对于所有这些功能。如上所述,否则可能会涉及更多。

Firebase 团队会定期维护 SDK,我们很快就会在即将发布的版本中看到对此的修复。

关于ios - Swift iOS 14 Firebase 警告——这个旧式函数定义之前没有原型(prototype),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67951214/

相关文章:

ios - 我需要为简单变量添加线程锁定吗?

Swift View Controller 和导航 Controller

ios - UIView 功能错误

ios - Firebase 不会创建子项

javascript - 如何检查日期并显示消息 - Javascript

ios - 如何将我目前正在开发的 Flutter iOS 应用程序分享给 friend /投资者,以便在他们的设备上进行测试或评论

ios - Swift 4 中的 AWS DynamoDB updateItem 问题

ios - 向 NSManagedObject 类添加函数

firebase - 使用物理设备运行简单的Firebase Flutter应用程序并获得Gradle错误

ios - 在 native ios 中获取 Google 加新闻提要