Hi friend, I saw a lot of reports about the accuracy problem with gps, but it doesn't work all the time
-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSString *latstr = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
NSString *longstring=[NSStringstringWithFormat:@"%f",newLocation.coordinate.longitude];
if (abs(howRecent)>5.0)
{
[self.locationManager startUpdatingLocation];
return;
}
if(abs(newLocation.horizontalAccuracy)<0.0f)
{
[self.locationManager startUpdatingLocation];
return;
}
if(newLocation.horizontalAccuracy>65.0f)
{
[self.locationManager startUpdatingLocation];
return;
}
self.latstring = [latstr copy];
self.longstr = [longstring copy];
if((updateLocationFirst||loadFirstView))
{
[[NSUserDefaults standardUserDefaults]setObject:latstring forKey:@"Latitude"];
[[NSUserDefaults standardUserDefaults]setObject:longstr forKey:@"Longitude"];
[self displayParticularDaySpecial];
loadFirstView=FALSE;
updateLocationFirst=FALSE;
[self.locationManager stopUpdatingLocation];
}
}
The problem here is that I am sending latitude and longitude to the google api with respect to some addresses, if I decrease the accuracy value by spending a lot of time downloading, and this value has a problem when you reach the destination with respect to the destination with a difference of 0.6 miles.
source
share