Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
在模拟器和真机上,NSInteger
是不同的类型定义:#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
在格式化字符串时,使用'%ld'会在真机中报该警告。解决办法:- use %zd for signed, %tu for unsigned, and %tx for hex.
這才將這討人厭的warning去除 @@
參考網址:
清理iOS工程中的Warnings