I am trying to grab Coordinates through LocationManager. I am getting perfect location when i am on WIFI network. But get incorrect location (in radius of 500m from my current position) when i switch to Cellular data.. I tried all combinations of "desiredAccuracy" but failed to get accurate co-ordinates. Any solution?
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
currentLocation = nil;
[locationManager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{if(currentLocation != nil)
currentLocation = NULL;
NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];
NSLog(@"Location age %f", locationAge);
if (locationAge > 0.1) return;
currentLocation = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude];
NSLog(@"current location - %@",currentLocation);
NSString *lat =[NSString stringWithFormat:@"%lf",currentLocation.coordinate.latitude];
NSString *lon =[NSString stringWithFormat:@"%lf",currentLocation.coordinate.longitude];
latitudeText.text = lat;
longitudeText.text = lon;
[manager stopUpdatingLocation];}