1

I have released a golf app based on GPS a year ago. To make the best use of it a high horizontal accuracy is needed. Everything was working fine since the release of the app (iOS 10 was the latest operating system version at that time). Now, customers are reporting bad accuracy with iOS12 mainly in combination with iPhone X derivatives.

I was able to reconstruct the issue on my development devices. On iPhone X horizontal accuracy of <5m is not achievable anymore. Was no issue before. On iPhone 6s this level of accuracy is achieved in rare cases. On both devices, iOS 12.2 was installed.

Here is the related code in my app:

Variable definition in the class:

var locationManager: CLLocationManager = CLLocationManager()

In View Did Load I have put:

locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.delegate = self
    locationManager.requestWhenInUseAuthorization()
    locationManager.requestAlwaysAuthorization()
    locationManager.startUpdatingLocation()

Then der is the following function to determine the location (latestLocation) which is processed in the code (not shown here):

func locationManager(_ manager: CLLocationManager,
                     didUpdateLocations locations: [CLLocation])
{

let latestLocation: CLLocation = locations[locations.count - 1]

horizontalAccuracy.text = String(format: "%.1f",latestLocation.horizontalAccuracy)


    if latestLocation.horizontalAccuracy <= 5.1 {
        horizontalDistance.backgroundColor = UIColor.green
    } else if latestLocation.horizontalAccuracy <= 10.1 {
        horizontalDistance.backgroundColor = UIColor.yellow
    } else {
        horizontalDistance.backgroundColor = UIColor.red
    }

    // remark: this sets the background color of a label according to 

achieved horizontal accuracy. Since iOS12 the maximum achieved level of accuracy with an iPhone X is medium (yellow background color).


/*
Some code processing location data
*/

}

In general, the code is executed as expected but on the basis of low accuracy data. Is there something is missed for iOS 12 or is there a way to enforce a higher accuracy? Thanks for your help!

brooksrelyt
  • 3,925
  • 5
  • 31
  • 54
Dirk
  • 25
  • 8
  • I just ran a test app on iPhone 8(12.2), iPhone 8 Plus(12.2), iPad Air 2 (12.2) and iPhone X(12.1.4) - all got 5m accuracy. On an iPhone XR (12.2) accuracy was between 3.5 and 4.1, so I don't think there is a general problem. GPS accuracy is highly dependent on location and the environment – Paulw11 Apr 06 '19 at 23:40
  • Thanks Paul. Does your test app use the same or similar code as described above. I changed in the code above kCLLocationAccuracyBest by kCLLocationAccuracyBestForNavigation. However, the accuracy was never better than 6.0 m (iPhone X, iOS12.2). – Dirk Apr 13 '19 at 13:04
  • 1
    Essentially the same, except I used Swift. I also set the activity type to `.fitness` - https://gist.github.com/paulw11/ea199a76b8e624ebb2ff3d809f022b13. What environment are you in? I tested outdoors, in a field. There are no buildings or high mountains or trees - Essentially the same conditions as a golf course. The phone was in my hand, not in a pocket. – Paulw11 Apr 13 '19 at 20:45
  • Thanks for your quick feedback again. With the same code - setting type to fitness and keeping kCLLocationAccuracyBest - I achieve after some waiting time now 6m horizontal accuracy. There are obviously different accuracy levels .. going to 12m then to 8m and finally to 6m horizontal as best value achieved. Formerly I experience 10m and finally 5m as best. I have the feeling that in my application kCLLocationAccuracyBest in combination with .fitness is working best (converging quickest to the best achievable level of accuracy). – Dirk Apr 28 '19 at 15:28

0 Answers0