ios – Format指定类型“unsigned long”但参数的类型为“int”

ios – Format指定类型“unsigned long”但参数的类型为“int”,第1张

概述Format指定类型“unsigned long”但参数的类型为“int” 我在XCode中得到此错误,无论我放入什么格式说明符,或者如果我更改为NSInteger,NSUInteger,long或int,仍然会出错!?我怎样才能解决这个问题? 在 -(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row @H_404_0@ @H_404_0@ Format指定类型“unsigned long”但参数的类型为“int”

我在XCode中得到此错误,无论我放入什么格式说明符,或者如果我更改为NSInteger,NSUInteger,long或int,仍然会出错!?我怎样才能解决这个问题?

-(UIVIEw *)pickerVIEw:(UIPickerVIEw *)pickerVIEw vIEwForRow:(NSInteger)row forComponent:(NSInteger)component reusingVIEw:(UIVIEw *)vIEw

{

我有这些行,第2行是@“%lu”的错误,(行%max)

NSUInteger max = (NSInteger)[self.calendar maximumRangeOfUnit:NSCalendarUnitHour].length;[lblDate setText:[Nsstring stringWithFormat:@"%lu",(row % max)]]; lblDate.textAlignment = NSTextAlignmentRight;

感谢帮助 !

解决方法 对于NSInteger,您应该使用%td或%tu来表示NSUInteger

有关详细信息,请参阅此链接https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

@H_404_0@ 总结

以上是内存溢出为你收集整理的ios – Format指定类型“unsigned long”但参数的类型为“int”全部内容,希望文章能够帮你解决ios – Format指定类型“unsigned long”但参数的类型为“int”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1006181.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存