locationManager:didFailWithError: not called if user Location Services are off

南笙酒味 提交于 2019-12-21 05:32:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!