search

Home  >  Q&A  >  body text

Objective-c - NSInteger reports warning

警告为: Values of type 'NSInteger' should not be used as format arguments...

漂亮男人漂亮男人2836 days ago716

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-02 09:38:19

    This is because the types of NSInteger are different under 32-bit and 64-bit platforms. NSInteger is int type under 32-bit platform and long type under 64-bit platform. If you select the 32-bit platform when compiling, (iPhone4, iPhone4s, iPhone5) then this warning will be reported, but if you choose a 64-bit platform (iPhone5s and above), then this warning will not be reported

    reply
    0
  • PHPz

    PHPz2017-05-02 09:38:19

    Use %zd,NSUinteger用%zu,保证是正整数也可以使用%zi

    reply
    0
  • Cancelreply