Hello i am using location in iOS app i set the accuracy like this:
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
and i am using this function to check the accuracy
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
print(manager.location!.horizontalAccuracy)
if locations.last!.horizontalAccuracy <= manager.desiredAccuracy{
print(manager.location)
location = locations.last!
locationManager.stopUpdatingLocation()
locationManager = nil
}
}
The problem is that the accuracy stack to 1414 and never goes to 100. Is there any way to fix that problem?
It's a limitation of the hardware, possible combined with your particular location. If you are indoors writing your code then GPS isn't going to work (try walking to a window), so you rely on WiFi which might just have very bad accuracy where you are, or on cell towers which isn't very accurate anywhere.
iOS uses multiple hardware options to determine location: cell tower, wifi access points, gps. The options are listed in increasing accuracy AND power consumption order.
iOS uses desiredAccuracy as a hint of which hardware it should engage to serve your request, and the OS will try to avoid activating the hardware it believes is unnecessary in order to achieve the desired accuracy.
I believe Apple does not offer any specifics as to what the threshold values are.
It looks like in your case iOS does not engage WiFi AP hardware (or might be unable to connect to a server to access the AP database, or there is not enough known APs around you), thus all location readings you get are from cell tower triangulation.
You may want to either
Also, this is not in the books, but you can tell if location reading is from GPS by looking at speed value, if it is invalid (less than zero), it is NOT GPS location.
Hope this helps, -- Alex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With