简体   繁体   English

警告消息“格式不是字符串文字,没有格式参数”

[英]warning message “format not a string literal and no format arguments”

I am seeing this warning message "format not a string literal and no format arguments" but it is not showing in which line message is occurring. 我看到这个警告消息“格式不是字符串文字和没有格式参数”但它没有显示在哪个行消息发生。 It is showing when I am debugging and running my application. 它在我调试和运行我的应用程序时显示。 My file name is addaccount.m and it has some header file connected. 我的文件名是addaccount.m,它连接了一些头文件。

why this not showing line number? 为什么这不显示行号?

Thanks in advance 提前致谢

It sounds like you have a bad NSLog function call. 听起来你有一个糟糕的NSLog函数调用。 Search for NSLog in your project and check if that's the thing. 在您的项目中搜索NSLog并检查是否是那样的。

If your pch file (common header) define a macro for nslog as below. 如果您的pch文件(公共标头)为nslog定义了一个宏,如下所示。 You will get the line number. 您将获得行号。

#   define CustomLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

And replace NSLog with CustomLog 并用CustomLog替换NSLog

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

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