LocationManager: didFailWithError: not raised if user-defined location services are disabled

From the documentation for locationManager: didFailWithError:

If a user denies your location services to your applications, this method reports a kCLErrorDenied error. Having received this error, you must stop the location service.

It works when the user clicks "Do not allow" to the question "MyApp would like to use your current location", so you can manage this event.

But nothing happens when the user clicks “Cancel” to the question “Enable location services to allow MyApp to determine your location” (a message that appears if Location services are disabled.

Is there any way to get a callback?

+3
source share
1 answer

Use [CLLocationManager locationServicesEnabled]for this specific case.

+6
source

Source: https://habr.com/ru/post/1523541/


All Articles