iOS 获取定位状态CLAuthorizationStatus的枚举

ClAuthorizationStatuse枚举是定位的时候关于授权状态的枚举:

public enum CLAuthorizationStatus : Int32 {

    
    // User has not yet made a choice with regards to this application
    case notDetermined

    
    // This application is not authorized to use location services.  Due
    // to active restrictions on location services, the user cannot change
    // this status, and may not have personally denied authorization
    case restricted

    
    // User has explicitly denied authorization for this application, or
    // location services are disabled in Settings.
    case denied

    
    // User has granted authorization to use their location at any time,
    // including monitoring for regions, visits, or significant location changes.
    //
    // This value should be used on iOS, tvOS and watchOS.  It is available on
    // MacOS, but kCLAuthorizationStatusAuthorized is synonymous and preferred.
    @available(iOS 8.0, *)
    case authorizedAlways

    
    // User has granted authorization to use their location only when your app
    // is visible to them (it will be made visible to them if you continue to
    // receive location updates while in the background).  Authorization to use
    // launch APIs has not been granted.
    //
    // This value is not available on MacOS.  It should be used on iOS, tvOS and
    // watchOS.
    @available(iOS 8.0, *)
    case authorizedWhenInUse

    
    // User has authorized this application to use location services.
    //
    // This value is deprecated or prohibited on iOS, tvOS and watchOS.
    // It should be used on MacOS.
    @available(iOS, introduced: 2.0, deprecated: 8.0, message: "Use kCLAuthorizationStatusAuthorizedAlways")
    public static var authorized: CLAuthorizationStatus { get }
}

一、第一个枚举值: kCLAuthorizationStatusNotDetermined 的意思是: 定位服务 授权状态是用户没有决定是否使用定位服务。

二、第二个枚举值:kCLAuthorizationStatusRestricted的意思是:定位服务授权状态是受限制的。可能是由于活动限制定位服务,用户不能改变。这个状态可能不是用户拒绝的定位服务。

三、第三个枚举值:kCLAuthorizationStatusDenied的意思是:定位服务授权状态已经被用户明确禁止,或者在设置里的定位服务中关闭。

四、第四个枚举值:kCLAuthorizationStatusAuthorizedAlways的意思是:定位服务授权状态已经被用户允许在任何状态下获取位置信息。包括监测区域、访问区域、或者在有显著的位置变化的时候。

五、第五个枚举值:kCLAuthorizationStatusAuthorizedWhenInUse的意思是:定位服务授权状态仅被允许在使用应用程序的时候。

六、第六个枚举值:kCLAuthorizationStatusAuthorized的意思是:这个枚举值已经被废弃了。他相当于

kCLAuthorizationStatusAuthorizedAlways这个值。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值