问题描述
我在iPhone上使用GPS,并显示使用位置服务的相符消息。我想捕捉用户选择允许或否。
可以任何一个建议我如何做到这一点?
谢谢
您无法从此警报中直接回拨。但是,如果用户不允许使用核心位置,则会收到 -locationManager:didFailWithError:
,其中 kCLErrorDenied
error to your CLLocationManagerDelegate
。
从iOS 4.2开始,您还可以收听 - locationManager:didChangeAuthorizationStatus:
或者检查 CLLocationManager
的 authorizationStatus
。这给你一个详细的状态。
I am using GPS in iphone and it show conformation message for use location service. and i want to trap what user select "Allow" or "No".can any one suggest how i do this?
Thank
You don't get a direct callback from this alert. However, if the user does not allow Core Location usage, you'll receive a -locationManager:didFailWithError:
with a kCLErrorDenied
error to your CLLocationManagerDelegate
.
Since iOS 4.2, you can also listen to -locationManager:didChangeAuthorizationStatus:
or check the authorizationStatus
of CLLocationManager
. This gives you a detailed status.
这篇关于如何陷阱位置警报响应iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!