User558
User558

Reputation: 1175

implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' warning?

Hi i am getting this error! i am using NSNumber in indexpath.row but it giving Warning,what is wrong in my code please help.

 NSNumber *num=[NSNumber numberWithInt:indexPath.row];
        [HUD showWhileExecuting:@selector(callingMethod:) onTarget:self  withObject:num animated:YES];

Upvotes: 1

Views: 2067

Answers (2)

BEN MESSAOUD Mahmoud
BEN MESSAOUD Mahmoud

Reputation: 736

you can use boxed expression. here how you can do :

NSNumber *num = @(indexPath.row]);
    [HUD showWhileExecuting:@selector(callingMethod:) onTarget:self  withObject:num animated:YES];

this will convert your number with the right format;

Let me know if this help you :)

Upvotes: 2

Arun
Arun

Reputation: 1411

indexPath.row is returning NSInteger value not int value. Try this

NSNumber *num=[NSNumber numberWithInteger:indexPath.row];

Upvotes: 7

Related Questions