【发布时间】:2014-03-26 19:36:26
【问题描述】:
这是我的全部代码:
[NSString stringWithFormat:@"Total Properties: %d", (int)[inArray count]];
这让我收到了 Xcode 5.1 警告:
Values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead
好吧,我很困惑。该值确实是 32 位 int,我将其转换为 32 位 int。那么它抱怨的这个 NSUInteger 是什么(我假设的计数),为什么这个演员不能解决它?
【问题讨论】:
-
您确定该行会产生警告吗?我自己一直使用它们强制转换为 int,而且我从来没有出错。刚刚在 Xcode 5.1 中通过一个简单的示例对其进行了检查。
-
希望能避免未来读者的困惑:此警告是否出现(或不出现)取决于您正在编译的架构。
标签: objective-c