iOS Location Accuracy

Panayiotis Irakleous picture Panayiotis Irakleous · Dec 22, 2015 · Viewed 8.1k times · Source

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?

Answer

gnasher729 picture gnasher729 · Dec 22, 2015

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.