问题
From the documentation for locationManager:didFailWithError:
If the user denies your application’s use of the location service, this method reports a kCLErrorDenied error. Upon receiving such an error, you should stop the location service.
It works when the user press "Don't Allow" to the question "MyApp Would Like to Use Your Current Location", so you can manage this eventuality.
But nothing happen when the user press "Cancel" to the question "Turn On Location Services to Allow "MyApp" to Determine Your Location" (message which comes if Location Services are turned OFF.
Is there a way to have any kind of callback?
回答1:
Use [CLLocationManager locationServicesEnabled]
for that particular case.
来源:https://stackoverflow.com/questions/12429249/locationmanagerdidfailwitherror-not-called-if-user-location-services-are-off