So I am dealing with some accuracy issues with iPhone GPS. I have an app which uses location.
In the delegate method locationManager: didUpdateToLocation: fromLocation:
I am being returned a location. From a bit of research, it appears the GPS isn't always accurate on the first result it returns, even when setting desiredAccuracy
property to kCLLocationAccuracyBest
.
In order to get around this, I don't call stopUpdatingLocation
before it's returned newLocation:
at least 3 times (this is very quick). I have also played around with two other "requirements" for whether to stopUpdatingLocation
and return the newLocation
. One way I tried was to check the lat and long for newLocation
and compare to oldLocation
and if these were not identical, then keep the location updating running. I also tried with checking the distance between the oldLocation
and newLocation
and if it's less than 20 meters, it's fine. Both of these are tested with the returning of at least 3 runs. The latter way is less "strict", since newLocation
and oldLocation
is quite hard to get away with being 100% identical if the user is in a moving vehicle.
Now, my issue is, that even when doing the above (basically not accepting a location, until a few updates have occured on CLLocationManager
AND checking the distance between the CLLocations
(or whether they are identical) I am still seeing somewhat weird results for locations sometimes, when testing.
It would be fixes sometimes if I leave the app, go into Maps.app, use the GPS, then open multitasking, force quit my app and then reopen it to get a clean launch.
Any experiences and possible solutions people have used to get around the same kind of issue? Comments and solutions appreciated :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…