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这个值。