【问题标题】:How to check GPS permission is on or off for specific our application in iOS?如何检查我们在 iOS 中特定应用程序的 GPS 权限是打开还是关闭?
【发布时间】:2013-04-04 02:23:26
【问题描述】:

使用 BOOL locaService=[CLLocationManager locationServicesEnabled];

它将返回一般 GPS 服务的布尔值,我们如何检查特定应用程序的服务是打开还是关闭。

【问题讨论】:

    标签: iphone ios objective-c gps


    【解决方案1】:

    [CLLocationManager authorizationStatus] 返回一个CLAuthorizationStatus,其类型定义为kCLAuthorizationStatusNotDetermined, kCLAuthorizationStatusRestricted, kCLAuthorizationStatusDenied,kCLAuthorizationStatusAuthorized

    kCLAuthorizationStatusAuthorized 表示您可以使用 GPS,其他任何内容都表示您不能。

    (kCLAuthorizationStatusDenied 表示他们已禁止您,kCLAuthorizationStatusRestricted 表示由于家长控制您不能,kCLAuthorizationStatusNotDetermined 表示用户尚未响应“允许此应用查看我的位置?”提示.)

    【讨论】:

      【解决方案2】:

      在 CLLocationManager 中检查 authorizationStatus

      授权状态

      返回应用程序使用位置的授权状态 服务。 + (CLAuthorizationStatus)授权状态

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-21
        • 1970-01-01
        相关资源
        最近更新 更多