简体   繁体   中英

I am getting a warning implicit conversion loses integer precision

I am getting a warning implicit conversion loses integer precision

NSMutableArray *arr ;

int x = [arr count];

How to solve it ?

Change int to NSUInteger . it will solve your problem.

NSArray count is NSUInteger.

On 64-bit systems, NSUInteger and NSInteger are 64-bits but int is 32-bit. So the value won't fit which results in the warning.

If you want to ignore this type of warning you can update project settings, to remove all Implicit conversion loses integer precision warnings, by setting

Implicit Conversion to 32 Bit Type to No

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM