问题描述
- 在NSMutableArray存储时间值
-
将时间值作为对象存储在数组中,并且随机访问。但是系统报错。代码:
NSMutableArray *timer=[[NSMutableArray alloc]init]; [timer addObject:[NSNumber numberWithDouble:timeOne]]; [timer addObject:[NSNumber numberWithDouble:timeTwo]]; int timeIndex = arc4random() % [timer count]; double timeToBeUse=[NSNumber numberWithDouble:[timer objectAtIndex:timeIndex]]
这行:
double timeToBeUse=[NSNumber numberWithDouble:[timer objectAtIndex:timeIndex]];
报出错误: Sending id to parameter of incompatible type 'double'
请前辈帮忙,谢谢。
解决方案
参考:
http://www.buildapp.net/iphone/show.asp?id=68268
时间: 2024-10-26 15:05:38