How to handle the Cancel button in the Warning window for location services

I use location services in my application. When I launch the application with location services enabled, everything is perfect. But if I turn off location services on a global scale and return to the application. This gives me a pop-up message “Enable location services to determine your location” using the two “Settings” and “Cancel” buttons.

If I click "Settings", it will lead me to the "Settings" application (as expected). But if I click Cancel, nothing happens. My application cannot receive the event, and it freezes, waiting for something. If I fired some other event after that that uses the current location, then it will not receive authorization, and the application will become normal.

To deal with this behavior, I want to detect a touch event on the Cancel button. Is there any way to do this. Since I think this pop is handled by the OS, not the SDK.

Correct me if I am wrong.

0
source share
1 answer

Here you can find the touch event on the "Cancel" button:

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{

}

, ( iOS). , ...

0

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


All Articles