DebugLog Format字符串不是字符串文字 [英] DebugLog Format string is not a string literal

查看:798
本文介绍了DebugLog Format字符串不是字符串文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码看起来像

  DebugLog(urlStr); 

urlStr是一个NSString
,但我不断收到一条警告说

 格式字符串不是字符串字面值

我从一个网站得到这个代码。

  #ifdef DEBUG 
#define DebugLog(s,。 ..)NSLog(s,## __ VA_ARGS__)
#else
#define DebugLog(s,...)
#endif
pre>

解决方案

尝试这样: DebugLog(@%@,urlStr);


My code looks like

DebugLog(urlStr);

urlStr is an NSString but I keep getting a warning saying

Format string is not a string literal

I got this code from a website.

#ifdef DEBUG
#define DebugLog(s, ...) NSLog(s, ##__VA_ARGS__)
#else
#define DebugLog(s, ...)
#endif

解决方案

Try this: DebugLog(@"%@", urlStr);

这篇关于DebugLog Format字符串不是字符串文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆