开发者

warning: format not a string literal and no format arguments

开发者 https://www.devze.com 2023-01-25 01:44 出处:网络
When i run the below code NSLog([NSString stringWithFormat:@\"Response count is %d\",response.pro开发者_开发百科ducts.count]);

When i run the below code

NSLog([NSString stringWithFormat:@"Response count is %d",response.pro开发者_开发百科ducts.count]);

i get a warning message like below

warning: format not a string literal and no format arguments

what is the problem in my syntax..


You don't need to create another autoreleased string, just pass it straight to NSLog:

NSLog(@"Response count is %d",response.products.count);

The reason why this warning is popping up is because you didn't supply a format string as the first argument to NSLog.

0

精彩评论

暂无评论...
验证码 换一张
取 消