title: How the get a higher GPS accuracy in iOS 12
body: <p>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. </p>
  
  <p>I was able to reconstruct the issue on my development devices. On iPhone X horizontal accuracy of &lt;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. </p>
  
  <p>Here is the related code in my app:</p>
  
  <p>Variable definition in the class:</p>
  
  <pre><code>var locationManager: CLLocationManager = CLLocationManager()
  </code></pre>
  
  <p>In View Did Load I have put:</p>
  
  <pre><code>locationManager.desiredAccuracy = kCLLocationAccuracyBest
      locationManager.delegate = self
      locationManager.requestWhenInUseAuthorization()
      locationManager.requestAlwaysAuthorization()
      locationManager.startUpdatingLocation()
  </code></pre>
  
  <p>Then der is the following function to determine the location (<code>latestLocation</code>) which is processed in the code (not shown here):</p>
  
  <pre><code>func locationManager(_ manager: CLLocationManager,
                       didUpdateLocations locations: [CLLocation])
  {
  
  let latestLocation: CLLocation = locations[locations.count - 1]
  
  horizontalAccuracy.text = String(format: "%.1f",latestLocation.horizontalAccuracy)
  
  
      if latestLocation.horizontalAccuracy &lt;= 5.1 {
          horizontalDistance.backgroundColor = UIColor.green
      } else if latestLocation.horizontalAccuracy &lt;= 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
  */
  
  }
  </code></pre>
  
  <p>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!</p>