隐式转换丢失整数精度 'NSUInteger'(又名 'unsigned long')到 'int' 警告?
implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' warning?
嗨,我收到了这个错误!我在 indexpath.row 中使用 NSNumber 但它发出警告,我的代码有什么问题请帮忙。
NSNumber *num=[NSNumber numberWithInt:indexPath.row];
[HUD showWhileExecuting:@selector(callingMethod:) onTarget:self withObject:num animated:YES];
indexPath.row
返回 NSInteger
值而不是 int
值。试试这个
NSNumber *num=[NSNumber numberWithInteger:indexPath.row];
你可以使用方框表达。在这里你可以怎么做:
NSNumber *num = @(indexPath.row]);
[HUD showWhileExecuting:@selector(callingMethod:) onTarget:self withObject:num animated:YES];
这会将您的号码转换为正确的格式;
如果这对你有帮助,请告诉我:)
嗨,我收到了这个错误!我在 indexpath.row 中使用 NSNumber 但它发出警告,我的代码有什么问题请帮忙。
NSNumber *num=[NSNumber numberWithInt:indexPath.row];
[HUD showWhileExecuting:@selector(callingMethod:) onTarget:self withObject:num animated:YES];
indexPath.row
返回 NSInteger
值而不是 int
值。试试这个
NSNumber *num=[NSNumber numberWithInteger:indexPath.row];
你可以使用方框表达。在这里你可以怎么做:
NSNumber *num = @(indexPath.row]);
[HUD showWhileExecuting:@selector(callingMethod:) onTarget:self withObject:num animated:YES];
这会将您的号码转换为正确的格式;
如果这对你有帮助,请告诉我:)