【问题标题】:I am getting a warning implicit conversion loses integer precision我收到警告隐式转换丢失整数精度
【发布时间】:2015-05-22 09:49:44
【问题描述】:

我收到警告implicit conversion loses integer precision

NSMutableArray *arr ;

int x = [arr count];

如何解决?

【问题讨论】:

标签: ios objective-c


【解决方案1】:

int 更改为NSUInteger。它会解决你的问题。

NSArray 计数为 NSUInteger。

在 64 位系统上,NSUInteger 和 NSInteger 是 64 位,而 int 是 32 位。因此该值不适合导致警告。

如果您想忽略此类警告,您可以更新项目设置,以删除所有隐式转换丢失整数精度警告,通过设置

将 32 位类型隐式转换为 No

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-05
    相关资源
    最近更新 更多