iOS之整型转换警告Values of type 'NSInteger' should not be used as format arguments;

来源:互联网 发布:linux select串口 编辑:程序博客网 时间:2024/06/14 10:37

苹果app支持arm64以后会有一个问题:NSInteger变成64位了,和原来的int (%d)不匹配,会报如下warning,


Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead


解决办法:

1、系统推荐方法   [NSString stringWithFormat:@“%ld"(long)number];


2、强制转换   [NSString stringWithFormat:@"%d"(int)number];


3、[NSString stringWithFormat:@“%@",@(number)];

1 0