I am getting a warning implicit conversion loses integer precision
NSMutableArray *arr ;
int x = [arr count];
How to solve it ?
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