Hello! Before using locationManager, an alert pops up - allow or disallow the use of data. So, how can I track that moment when the user pressed the button and which one (allowed or not) and continue to execute the necessary code?

    2 answers 2

    Finding out what the user clicked will not work, but you can find out if your application has access to the location definition via [CLLocationManager locationServicesEnabled]; or start requesting a location using -startUpdatingLocation and if the delegate receives -locationManager:didFailWithError: in response, then the user answered no.

      You must use the CLLocationManagerDelegate method

       - (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status