I am trying to use CLLocationDistance to get a distance from a starting point. But for some reason when I load the app onto my iphone and run it and dont even move the iphone, after about 3 seconds the distance label displays a number like "2333.34 m" which is obviously not right due to the fact I have not moved the iphone.
Anyone got an idea of why it is doing that?
Thanks a lot.
Code:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if (startingPoint == nil)
self.startingPoint = newLocation;
CLLocationDistance distance = [newLocation getDistanceFrom:startingPoint];
NSString *distanceString = [[NSString alloc] initWithFormat:@"%g", distance];
distanceLabel.text = distanceString;
}
Anyone got an idea of why it is doing that?
Thanks a lot.