there is a coordinate object with three variables latitude(NSNumber) ,longitude(NSNumber) and time(NSDate),for checking the program on my simulator,i gave the folowing code
[coordinate setLatitude:[NSNumber numberWithDouble:23.234223]];
[coordinate setLongitude:[NSNumber numberWithDouble:73.234323]];
however when i NSLog coordinate.latitude and coordinate.longitude,it diplays 0.00000
NSLog(@"cordlat : %f",coordinate.latitude);
NSLog(@"cordlong : %f",coordinate.longitude);
what can be the problem???
You can't print an NSNumber
with %f
. You can do one of the following:
NSLog(@"cordlat : %@", coordinate.latitude);
NSLog(@"cordlat : %f", coordinate.latitude.doubleValue);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With