I'm using following conditions in-order to make sure that the location i get has adequate accuracy, In my case kCLLocationAccuracyBest. But the problem is that i still get inaccurate location.
// Filter out nil locations
if(!newLocation)
return;
// Make sure that the location returned has the desired accuracy
if(newLocation.horizontalAccuracy < manager.desiredAccuracy)
return;
// Filter out points that are out of order
if([newLocation.timestamp timeIntervalSinceDate:oldLocation.timestamp] < 0)
return;
// Filter out points created before the manager was initialized
NSTimeInterval secondsSinceManagerStarted = [newLocation.timestamp timeIntervalSinceDate:locationManagerStartDate];
if(secondsSinceManagerStarted < 0)
return;
// Also, make sure that the cached location was not returned by the CLLocationManager (it's current) - Check for 5 seconds difference
if([newLocation.timestamp timeIntervalSinceReferenceDate] < [[NSDate date] timeIntervalSinceReferenceDate] - 5)
return;
When i activate the GPS, i get inaccurate results before i actually get an accurate result. What methods do you use to get accurate/precise location information?
The main reason i was getting inaccurate results was because of this condition:
if(newLocation.horizontalAccuracy < manager.desiredAccuracy)
I was using kCLLocationAccuracyBest
as desiredAccuracy and it's a negative number. You shouldn't use it for comparison.
Solution:
if(newLocation.horizontalAccuracy < 10.0)