DMKLocationAdapter Class Reference

Inherits from NSObject
Declared in DMKLocationAdapter.h
DMKLocationAdapter.m

Overview

持续定位、权限API入口类 同步获取定位数据对应的ID tag 定位权限相关API

Other Methods

+ sharedInstance

单例入口方法

+ (instancetype)sharedInstance

Discussion

单例入口方法

Declared In

DMKLocationAdapter.h

– registerWithDelegate:locationConfig:error:

注册持续定位监听,注册成功后代理对象自动开始接收相关定位回调 更新持续定位监听配置

- (BOOL)registerWithDelegate:(id<DMKLocationAdapterDelegate>)delegate locationConfig:(DMKLocationConfig *__nonnull)config error:(NSError **__nullable)errorPtr

Parameters

delegate

回调代理对象

config

业务定位相关配置

errorPtr

错误信息

Discussion

注册持续定位监听,注册成功后代理对象自动开始接收相关定位回调 更新持续定位监听配置

Declared In

DMKLocationAdapter.h

– unregisterWithDelegate:error:

移除注册

- (BOOL)unregisterWithDelegate:(id<DMKLocationAdapterDelegate>)delegate error:(NSError **__nullable)errorPtr

Parameters

delegate

回调代理对象

errorPtr

错误信息

Discussion

移除注册

Declared In

DMKLocationAdapter.h

– configWithDelegate:

根据业务信息获取当前定位配置。找不到返回nil

- (DMKLocationConfig *)configWithDelegate:(id<DMKLocationAdapterDelegate>)delegate

Parameters

delegate

回调代理对象

Discussion

根据业务信息获取当前定位配置。找不到返回nil

Declared In

DMKLocationAdapter.h

– currentLocation

同步获取当前缓存的最新定位数据 建议使用时判断定位时间戳有效性

- (DMKLocation *)currentLocation

Discussion

同步获取当前缓存的最新定位数据 建议使用时判断定位时间戳有效性

Declared In

DMKLocationAdapter.h

– latestLocationsWithCount:

最新的位置数据未做时间戳有效校验,最多返回20个

- (NSArray<DMKLocation*> *)latestLocationsWithCount:(NSUInteger)count

Parameters

count

要获取的个数,返回有可能小于count

Discussion

最新的位置数据未做时间戳有效校验,最多返回20个

Declared In

DMKLocationAdapter.h

– currentWGS84Location

同步获取当前缓存的最新84坐标定位数据 建议使用时判断定位时间戳有效性

- (DMKLocation *)currentWGS84Location

Discussion

同步获取当前缓存的最新84坐标定位数据 建议使用时判断定位时间戳有效性

Declared In

DMKLocationAdapter.h

– latestWGS84LocationsWithCount:

最新84坐标的位置数据未做时间戳有效校验,最多返回20个

- (NSArray<DMKLocation*> *)latestWGS84LocationsWithCount:(NSUInteger)count

Parameters

count

要获取的个数,返回有可能小于count

Discussion

最新84坐标的位置数据未做时间戳有效校验,最多返回20个

Declared In

DMKLocationAdapter.h

– requestLocationWithCompletionBlock:

异步获取单次当前定位数据

- (void)requestLocationWithCompletionBlock:(DMKLocatingCompletionBlock __nonnull)completionBlock

Parameters

completionBlock

完成闭包,location为最新定位数据 location为nil表示失败,可从error获取详细信息

Discussion

异步获取单次当前定位数据

Declared In

DMKLocationAdapter.h

– requestWGS84LocationWithCompletionBlock:

异步获取84坐标系单次当前定位数据

- (void)requestWGS84LocationWithCompletionBlock:(DMKLocatingCompletionBlock __nonnull)completionBlock

Parameters

completionBlock

完成闭包,location为最新定位数据 location为nil表示失败,可从error获取详细信息

Discussion

异步获取84坐标系单次当前定位数据

Declared In

DMKLocationAdapter.h

– currentHeading

同步获取当前缓存的最新方向数据 返回值为系统返回的原始数据

- (CLHeading *)currentHeading

Discussion

同步获取当前缓存的最新方向数据 返回值为系统返回的原始数据

Declared In

DMKLocationAdapter.h

– headingDegrees

获取朝向角度信息 该信息针对系统返回CLHeading做过有效性处理

- (CGFloat)headingDegrees

Discussion

获取朝向角度信息 该信息针对系统返回CLHeading做过有效性处理

Declared In

DMKLocationAdapter.h

– pauseUpdatingLocationWithCallerId:

谨慎使用,一旦暂停任何业务都无法使用定位能力 暂停当前定位,业务注册的监听状态不会被改变,暂停接收系统定位更新

- (void)pauseUpdatingLocationWithCallerId:(NSString *__nonnull)callerId

Parameters

callerId

调用方标识(没有特殊要求可传调用方类名,或者自行拼接字符串)

Discussion

谨慎使用,一旦暂停任何业务都无法使用定位能力 暂停当前定位,业务注册的监听状态不会被改变,暂停接收系统定位更新

Declared In

DMKLocationAdapter.h

– resumeUpdatingLocationWithCallerId:

恢复pause之前的状态,业务注册的监听状态不会被改变

- (void)resumeUpdatingLocationWithCallerId:(NSString *__nonnull)callerId

Parameters

callerId

调用方标识(没有特殊要求可传调用方类名,或者自行拼接字符串)

Discussion

恢复pause之前的状态,业务注册的监听状态不会被改变

Declared In

DMKLocationAdapter.h

– enableNetLocation:

业务设置网络定位是否可用

- (void)enableNetLocation:(BOOL)enable

Discussion

业务设置网络定位是否可用

Declared In

DMKLocationAdapter.h

– stackInfoOnUpdateLocation

获取定位更新时缓存的堆栈信息

- (NSArray<NSString*> *)stackInfoOnUpdateLocation

Discussion

获取定位更新时缓存的堆栈信息

Declared In

DMKLocationAdapter.h

Other Methods

– checkLocationManagerBackgroundAbility

开启定位监听:当前配置和本次即将修改的不一样时开启,被暂停过的也不再处理

- (void)checkLocationManagerBackgroundAbility

Discussion

开启定位监听:当前配置和本次即将修改的不一样时开启,被暂停过的也不再处理

Declared In

DMKLocationAdapter.m

– locationManagerDidFailWithError:

定位失败回调

- (void)locationManagerDidFailWithError:(nonnull NSError *)error

Discussion

定位失败回调

Declared In

DMKLocationAdapter.m

– locationManagerDidUpdateLocation:

定位成功回调

- (void)locationManagerDidUpdateLocation:(CLLocation *)location

Discussion

定位成功回调

Declared In

DMKLocationAdapter.m

– locationGCJ02DidUpdatePublish:

02坐标定位结果分发

- (void)locationGCJ02DidUpdatePublish:(DMKLocation *)location

Discussion

02坐标定位结果分发

Declared In

DMKLocationAdapter.m

– locationWGS84DidUpdatePulish:

84坐标定位结果分发

- (void)locationWGS84DidUpdatePulish:(DMKLocation *)location

Discussion

84坐标定位结果分发

Declared In

DMKLocationAdapter.m

– locationManagerDidUpdateHeading:

朝向变化回调

- (void)locationManagerDidUpdateHeading:(CLHeading *)newHeading

Discussion

朝向变化回调

Declared In

DMKLocationAdapter.m

– locationManagerDidChangeAuthorizationStatus:

权限变化回调

- (void)locationManagerDidChangeAuthorizationStatus:(CLAuthorizationStatus)status

Discussion

权限变化回调

Declared In

DMKLocationAdapter.m

– cacheLatestGCJ02Location:

缓存最新接收到的02位置信息到内存

- (void)cacheLatestGCJ02Location:(DMKLocation *)location

Discussion

缓存最新接收到的02位置信息到内存

Declared In

DMKLocationAdapter.m

– cacheLatestWGS84Location:

缓存最新接收到的84位置信息到内存

- (void)cacheLatestWGS84Location:(DMKLocation *)location

Discussion

缓存最新接收到的84位置信息到内存

Declared In

DMKLocationAdapter.m

Extension Methods

  clientTable

容器:delegate地址字符串为key,DMKLocationClientModel为Value { @“delegate的address” : DMKLocationClientModel, }

@property (nonatomic, strong) NSMutableDictionary<NSString*DMKLocationClientModel*> *clientTable

Discussion

容器:delegate地址字符串为key,DMKLocationClientModel为Value { @“delegate的address” : DMKLocationClientModel, }

Declared In

DMKLocationAdapter.m

  latestGCJ02Locations

缓存最新的GCJ02位置最大20条

@property (nonatomic, strong) NSMutableArray<DMKLocation*> *latestGCJ02Locations

Discussion

缓存最新的GCJ02位置最大20条

Declared In

DMKLocationAdapter.m

  latestWGS84Locations

缓存最新的WSG84位置最大20条

@property (nonatomic, strong) NSMutableArray<DMKLocation*> *latestWGS84Locations

Discussion

缓存最新的WSG84位置最大20条

Declared In

DMKLocationAdapter.m

  lastHeading

系统最后一次返回的方向数据

@property (atomic, strong) CLHeading *lastHeading

Discussion

系统最后一次返回的方向数据

Declared In

DMKLocationAdapter.m

  systemCurrentConfig

系统定位上次配置

@property (nonatomic, strong) DMKLocationSystemCurrentConfig *systemCurrentConfig

Discussion

系统定位上次配置

Declared In

DMKLocationAdapter.m

  location_client_lock

操作业务容器同步锁

@property (nonatomic, strong) dispatch_semaphore_t location_client_lock

Discussion

操作业务容器同步锁

Declared In

DMKLocationAdapter.m

  stackInfo

缓存的定位更新时的堆栈信息

@property (atomic, strong) NSArray<NSString*> *stackInfo

Discussion

缓存的定位更新时的堆栈信息

Declared In

DMKLocationAdapter.m

  stackInfoUpdateTime

更新堆栈信息的时间戳

@property (nonatomic, strong) NSDate *stackInfoUpdateTime

Discussion

更新堆栈信息的时间戳

Declared In

DMKLocationAdapter.m

Authorization Methods

+ locationServicesEnabled

获取系统隐私-定位服务全局开关状态

+ (BOOL)locationServicesEnabled

Discussion

获取系统隐私-定位服务全局开关状态

Declared In

DMKLocationAdapter+Authorization.h

+ locationAuthorizationEnabled

获取当前是否是授权状态

+ (BOOL)locationAuthorizationEnabled

Discussion

获取当前是否是授权状态

Declared In

DMKLocationAdapter+Authorization.h

+ authorizationStatus

获取当前系统定位权限

+ (CLAuthorizationStatus)authorizationStatus

Discussion

获取当前系统定位权限

Declared In

DMKLocationAdapter+Authorization.h

+ checkFullAccuracyAuthorization

获取定位精度等级:

+ (DMKAccuracyAuthorizationType)checkFullAccuracyAuthorization

Discussion

获取定位精度等级:

Declared In

DMKLocationAdapter+Authorization.h

+ requestAuthorization

请求获取APP应用中的定位权限

+ (void)requestAuthorization

Discussion

请求获取APP应用中的定位权限

Declared In

DMKLocationAdapter+Authorization.h

+ requestAuthorizationWithMeessage:container:

展示定位权限引导设置弹窗

+ (void)requestAuthorizationWithMeessage:(NSString *__nullable)message container:(UIViewController *)vc

Parameters

message

自定义弹框文案,未设置使用默认文案

vc

展示容器页面

Discussion

展示定位权限引导设置弹窗

Declared In

DMKLocationAdapter+Authorization.h

+ requestFullAccuracyAuthorizationWithMeessage:container:

展示高精度引导视图

+ (void)requestFullAccuracyAuthorizationWithMeessage:(NSString *__nullable)message container:(UIViewController *)vc

Parameters

message

自定义弹框文案,未设置使用默认文案

vc

展示容器页面

Discussion

展示高精度引导视图

Declared In

DMKLocationAdapter+Authorization.h