簡體   English   中英

隱式轉換將整數精度'NSUInteger'(aka'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];

這將以正確的格式轉換您的電話號碼;

讓我知道這是否對您有幫助:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM