zoukankan      html  css  js  c++  java
  • [BS-15] Values of type 'NSInteger' should not be used as format arguments

    Values of type 'NSInteger' should not be used as format arguments

    苹果app支持arm64以后会有一个问题:NSInteger变成64位了,和原来的int (%d)不匹配,使用[NSString stringWithFormat:@“%d", integerNum]; 会报如下警告:

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

    解决办法:

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

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

    3、转为数字对象  [NSString stringWithFormat:@“%@", @(integerNum)];

    4、使用%zd占位符  [NSString stringWithFormat:@“%zd"integerNum];  (最简单的方法)

    补充:

    关于%zd格式化字符,只能运行在支持C99标准的编译器中,表示对应的数字是一个size_t类型,size_t是unsigned int 的增强版,表示与机器类型相关的unsigned类型,即:size-t在32位系统下是unsigned int(4个字节),在64位系统中为long unsigned int(8个字节)。

     

    C语言转义字符

         \ 反斜杠

      a 警告

       退格

      f 换页

       换行

       回车

       跳格Tab

      v 垂直跳格

          空格在输入时不需要转义,直接敲空格

     

     

    iOS开发者交流群:180080550
  • 相关阅读:
    SSH框架——(二)四层结构:DAO,Service,Controller,View层
    Spring知识概括梳理
    设计模式——(一)工厂模式2
    设计模式——(一)工厂模式1
    Spring——(一)IoC
    Toad 实现 SQL 优化
    string 和String的区别
    StructureMap依赖注入
    Oracle/PLSQL: BitAnd Function
    log.debug(e.getMessage());
  • 原文地址:https://www.cnblogs.com/stevenwuzheng/p/5470034.html
Copyright © 2011-2022 走看看