I am using GoogleMap-IOS-1.8.1 SDK for showing map. I have to calculate walking distance travelled by user. After searching i will try to use CLLocationManager's method -
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
double new_travelled_distance = [newLocation distanceFromLocation:oldLocation];
total_distanceTravelled_by_user += new_travelled_distance; }
and initialising like this-
-(void)viewDidLoad{
[super viewDidLoad];
if(!locationManager)
{
locationManager = [[CLLocationManager alloc] init];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:5.0f]; // measured in meters
[locationManager setHeadingFilter:kCLHeadingFilterNone]; // measured in degrees
[locationManager setDesiredAccuracy:kCLLocationAccuracyBestForNavigation];
}
[locationManager startUpdatingLocation]; }
But this doesn't provide data with accuracy, even i am sitting on same place not travelled a single meter but it give me regularly update for changing location. Should i have to correct " CLLocationManager's distanceFilter " property or what can i do for calculating more accurately travelling distance...?