[英]About String warning format is not a string literal and no format arguments
Hi i am using following code. 嗨,我正在使用以下代码。
NSString *quant = [NSString stringWithFormat:@"%@",item.capacity];
NSString *metricUnit = item.metric_Unit;
cell.quantity.text = [quant stringByAppendingFormat:metricUnit];
while quant is nsnumber and im getting a warning named "format is not a string literal and no format arguments" and im trying many was but did nt success, plzz if any one know how to remove that warning plzz tell ... 而quant是nsnumber,我得到了一个警告,警告是“格式不是字符串文字,没有格式参数”,我尝试了很多,但是nt成功,请plzz是否有人知道如何删除该警告,请plzz告诉...
Hope your positive response 希望您的积极回应
The warning is self-descriptive - api expects format you're passing to stringByAppendingFormat
function to be a string literal. 警告是自描述性的stringByAppendingFormat
希望您传递给stringByAppendingFormat
函数的格式为字符串文字。 To avoid this warning you can just append a string (as you don't use format parameters anyway): 为了避免出现此警告,您可以仅附加一个字符串(因为无论如何您都不使用格式参数):
cell.quantity.text = [quant stringByAppendingString:metricUnit];
or 要么
cell.quantity.text = [quant stringByAppendingFormat:@"%@",metricUnit];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.