从数组中获取双精度值,iphone
NSDecimalNumber *lat = [[NSDecimalNumber alloc]initWithDouble:sqlite3_column_double(selectStatement, 1)];
[latt addObject:lat];
[lat release];
CLLocationCoordinate2D annot;
annot.latitude = [[latt objectAtIndex:k]doubleValue];
上面的 2 段代码显示了从数组中创建和检索双精度值。我在数据库中存储了一些 double 类型的值。我检索它们并将它们存储在一个数组中。我在那里没有遇到任何问题。
但是,当我尝试将它们从数组中取出时,就像在第二个数组中一样,我收到一条警告,如果“objectAtIndex”从整数中生成指针而不进行强制转换,则 paasing argument 1 。可能是什么问题?
另外,当我尝试将存储在数组中的无符号整数作为 NSNumber 分配给无符号整数变量时,我收到一条警告:“AssignmentMakes Pointer from Integer without a Cast”。这些警告指向什么?
[back addObject:[NSNumber numberWithUnsignedInt:12]];
k = [[back objectAtIndex:0]unsignedIntegerValue];
NSDecimalNumber *lat = [[NSDecimalNumber alloc]initWithDouble:sqlite3_column_double(selectStatement, 1)];
[latt addObject:lat];
[lat release];
CLLocationCoordinate2D annot;
annot.latitude = [[latt objectAtIndex:k]doubleValue];
The above 2 codes shows the creation and retrieving of double values from an array. I've stored some values of type double in the database. I retrieve them and store them in an array. I'm not getting any problem there.
But when i try to get them out of the array, as in the second one, i'm getting a warning, paasing argument 1 if 'objectAtIndex' makes pointer from integer without a cast. What might be the problem?
Also when i try to assign the unsigned integer stored in the array as NSNumber to an unsigned integer variable, 'm getting a warning assignmentmakes pointer from integer without a cast. What are these warnings pointing to?
[back addObject:[NSNumber numberWithUnsignedInt:12]];
k = [[back objectAtIndex:0]unsignedIntegerValue];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
k
定义为 NSUInteger:Define
k
as an NSUInteger: