码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-12-28 06:11:35      阅读:460      评论:0      收藏:0      [点我收藏+]

标签:

苹果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

 

解决办法:

0,

NSInteger number = 0;

 NSString *str = [NSString stringWithFormat:@"%d", number];

假如number这个值32位足够了,

0、可以更改数字定义为int number  0

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

 

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

 

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

 

技术分享技术分享

点击左侧小圆点,自动修改

技术分享

技术分享

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

标签:

原文地址:http://www.cnblogs.com/LDSmallCat/p/5081332.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!