1

The iOS CLLocationManager reports various errors in its didFailWithError method: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CoreLocationConstantsRef/Reference/reference.html#//apple_ref/c/econst/kCLErrorDenied

In the documentation it is not clear which of these error (except kCLErrorDenied and kCLErrorLocationUnknown) stop the location manager and location updates?

Regards,

Hyndrix
  • 4,282
  • 7
  • 41
  • 82
  • The link is broken. Here is the valid one now: [https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/1423786-locationmanager/](https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/1423786-locationmanager/) – J Kasparian Feb 12 '22 at 18:24

2 Answers2

0

Try to print your error object description. You will get to know what was the reason for failure. The possible reason could be either you haven't granted permission to use location to your app or manually have revoked to use location.

If you are failing in simulator then make sure the simulator is pointing to some custom location.

Balram Tiwari
  • 5,657
  • 2
  • 23
  • 41
  • 1
    I do know what the errors mean from the documentation and I can force some of them (the two mentioned above). But my question was which of these errors stop the location manager and which are just for information purpose and will not stop the location manager. This is for instance of interest if you want to record a GPS track. – Hyndrix Feb 20 '14 at 13:06
0

In my experience, these errors do not stop the location manager. You may however need to handle possible changes in the authorizations by using the function

func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
    // here you call the function where you manage the location authorizations at the launch of the app
}
 
J Kasparian
  • 465
  • 2
  • 7