How can I determine if location information returned by CLLocationManager is valid?
相关问题
- Image loads in simulator but not device?
- UIModalTransitionStyleFlipHorizontal flips Vertica
- iOs (CoreLocation) - locationManager:didUpdateLoca
- Xcode4 templates now use underscore on iVars?
- How can i associate an IBAction event with an imag
相关文章
- Xcode: Is there a way to change line spacing (UI L
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- How to get a CGImageRef from Context-Drawn Images?
- Why are my UIView layer properties not being set w
- create UIImageView
- Can I add a border to an SKSpriteNode, similar to
- textFieldDidBeginEditing: for more than one textfi
- UIView subclass draws background despite completel
Two things to look for, the timestamp and the hdop (Horizontal Degree of Precision). The first one will tell you when the reading was taken, the second will tell you the level of error in the reading. For example a hdop of 1000 will tell you that the measurement is accurate to within 1000 metres. Obviously the lower the hdop the better.
They are both in the Core Location update you get.
Also, if the horizontal accuracy is negative, then the latitude and longitude are invalid.
You can't be absolutely certain. You'll get the phone's best idea about where it is, and you can believe it or not, but you can't easily verify that location.
One thing that may help some is to check the timestamp the locations you get. Core Location will cache data, and the first result you get may be a very old reading. If the phone has moved at all it may be inaccurate. On the other hand it might still be correct, and you really can't be sure until new results come in. Nevertheless it's often useful to throw away any data from Core Location where the timestamp is from before your app started up-- it might be good data but there's a decent chance that it's not. Later readings will be new and are as trustworthy as the phone can make them.