有一个坐标对象有三个变量纬度(NSNumber),经度(NSNumber)和时间(NSDate),为了检查我的模拟器上的程序,我给了下面的代码
[coordinate setLatitude:[NSNumber numberWithDouble:23.234223]];
[coordinate setLongitude:[NSNumber numberWithDouble:73.234323]];
Run Code Online (Sandbox Code Playgroud)
但是当我NSLog coordinate.latitude和coordinate.longitude时,它会显示0.00000
NSLog(@"cordlat : %f",coordinate.latitude);
NSLog(@"cordlong : %f",coordinate.longitude);
Run Code Online (Sandbox Code Playgroud)
可能是什么问题???
你不能打印NSNumber
用%f
.您可以执行以下操作之一:
NSLog(@"cordlat : %@", coordinate.latitude);
NSLog(@"cordlat : %f", coordinate.latitude.doubleValue);
归档时间: |
|
查看次数: |
20989 次 |
最近记录: |