gpt4 book ai didi

ios - Xcode 警告 : No Previous Prototype for Function

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:20:31 26 4
gpt4 key购买 nike

我在以下代码中收到警告“函数‘LocStr’没有以前的原型(prototype)”:

NSString *LocStr(NSString *const key) {
return [[NSBundle mainBundle] localizedStringForKey:key value:nil table:nil];
}

所有代码都工作正常,将应用程序提交到 App Store 时出现此警告是否有问题?这个警告有问题吗?

我可以在 Build Settings -> Missing Function Prototypes -> NO 中禁用原型(prototype)警告。但我想确保此警告不会在将来导致崩溃和拒绝。

有人吗?

谢谢!

最佳答案

看看这个。您可能违反了这里的哪些可能性?

no previous prototype for `foo'

This means that GCC found a global function definition without seeing a prototype for the function.

o If a function is used in more than one file, there should be a prototype for it in a header file somewhere. This keeps functions and their uses from getting out of sync

o If the function is only used in this file, make it static to guarantee that it'll never be used outside this file document that it's a local function

[Source]

请不要忽视警告,除非您知道它们是什么,它们可能构成比您意识到的更大的威胁。


与您的问题略有关系,但您可能会发现这更容易本地化您的字符串。这是我使用的解决方案:

#define local(s) NSLocalizedString(s, s)

然后调用 local(@"myStringKey");

关于ios - Xcode 警告 : No Previous Prototype for Function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7863313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com