Pages

Saturday, 27 December 2014

Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'

If you add 64bit support to your app (arm64 architectures added)you may notice a compiler warning when you do this:
Implicit conversion loses integer precision: ‘NSInteger’ (aka ‘long’) to ‘int’
Your code still works.
But resolve that warning ,We can use typecasting...

e.g.code

int count = [myColors count]; 
//that gives warning as "Implicit conversion loses integer precision :"NsInteger' (aka 'long') to 'int'

simply typecast  as follows

int count = (int) [myColors count];//simply typecast this and warning will be resolve







No comments:

Post a Comment