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


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

    解决办法:

     NSInteger number = 0;

    0.   NSString *str = [NSString stringWithFormat:@"%d", number];假如number这个值32位足够了,可以更改数字定义为int number  0

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

     

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

     

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

     

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

  • 相关阅读:
    day4笔记
    day3笔记
    day2 python基础 while 循环补充
    day1笔记 初识python,paython基础
    指针-1
    scanf输入与getchar的比较
    [递归]母牛的故事
    安装mysql以及遇到的问题解决
    33.指针
    32.字符串
  • 原文地址:https://www.cnblogs.com/LDSmallCat/p/5081332.html
Copyright © 2020-2023  润新知