View Full Version : Argg...is CLLocation broken?
detz
Aug 9, 2008, 12:58 PM
CLLocation *test1 = [[CLLocation alloc] initWithLatitude:42.27818011 longitude: -71.39553308];
CLLocation *test2 = [[CLLocation alloc] initWithLatitude:42.27818012 longitude: -71.39553308];
double diff = 0;
diff = [test1 getDistanceFrom:test2];
diff is -347598198. I can't get this to work at all.
slycrel
Aug 11, 2008, 12:21 AM
I am using getDistanceFrom: fairly heavily and I haven't noticed any problems. However, I have been using this with locations passed back to me by locationManager:didUpdateToLocation:fromLocation:, only rarely (when my app is restarted after it has quit) do I use initWithLatitude:, though it seems to work fine there as well. It could be a precision issue, I don't know how far the location manager looks.
Good luck.
ben.greeley
Dec 13, 2010, 09:55 PM
I'm having the same exact issue. Did you ever figure out what the cause of the issue was?
ulbador
Dec 13, 2010, 11:06 PM
I have a dollar. It says you are doing something like:
NSLog(@"diff: %d",diff);
Print a float instead:
NSLog(@"diff: %.0f",diff);
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.