[英]Location Services enabled for specific app?
有没有办法确定是否已针对特定应用程序禁用了位置服务? 问题是[CLLocationManager locationServicesEnabled]返回YES,即使已针对特定应用程序禁用了位置服务...
如果您的目标是iOS 4.2及更高版本,请使用[CLLocationManager authorizationStatus]
它将返回以下CLAuthorizationStatus
值之一,它们基本上只是整数:
typedef enum {
kCLAuthorizationStatusNotDetermined = 0,
kCLAuthorizationStatusRestricted,
kCLAuthorizationStatusDenied,
kCLAuthorizationStatusAuthorized
} CLAuthorizationStatus;
在文档中搜索“CLLocationManager”以获取更多信息。
实现位置管理器的委托时,应该实现didFailWithError。 如果用户不允许访问位置,那么您将收到相应的错误
Apple文档状态:如果用户拒绝您的应用程序使用位置服务,则此方法会报告kCLErrorDenied
错误。 收到此类错误后,您应该停止位置服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.