DMKLocationAdapter Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | DMKLocationAdapter.h DMKLocationAdapter.m |
Other Methods
+ sharedInstance
单例入口方法
+ (instancetype)sharedInstanceDiscussion
单例入口方法
Declared In
DMKLocationAdapter.h
– registerWithDelegate:locationConfig:error:
注册持续定位监听,注册成功后代理对象自动开始接收相关定位回调 更新持续定位监听配置
- (BOOL)registerWithDelegate:(id<DMKLocationAdapterDelegate>)delegate locationConfig:(DMKLocationConfig *__nonnull)config error:(NSError **__nullable)errorPtrParameters
delegate |
回调代理对象 |
|---|---|
config |
业务定位相关配置 |
errorPtr |
错误信息 |
Discussion
注册持续定位监听,注册成功后代理对象自动开始接收相关定位回调 更新持续定位监听配置
Declared In
DMKLocationAdapter.h
– unregisterWithDelegate:error:
移除注册
- (BOOL)unregisterWithDelegate:(id<DMKLocationAdapterDelegate>)delegate error:(NSError **__nullable)errorPtrParameters
delegate |
回调代理对象 |
|---|---|
errorPtr |
错误信息 |
Discussion
移除注册
Declared In
DMKLocationAdapter.h
– configWithDelegate:
根据业务信息获取当前定位配置。找不到返回nil
- (DMKLocationConfig *)configWithDelegate:(id<DMKLocationAdapterDelegate>)delegateParameters
delegate |
回调代理对象 |
|---|
Discussion
根据业务信息获取当前定位配置。找不到返回nil
Declared In
DMKLocationAdapter.h
– currentLocation
同步获取当前缓存的最新定位数据 建议使用时判断定位时间戳有效性
- (DMKLocation *)currentLocationDiscussion
同步获取当前缓存的最新定位数据 建议使用时判断定位时间戳有效性
Declared In
DMKLocationAdapter.h
– latestLocationsWithCount:
最新的位置数据未做时间戳有效校验,最多返回20个
- (NSArray<DMKLocation*> *)latestLocationsWithCount:(NSUInteger)countParameters
count |
要获取的个数,返回有可能小于count |
|---|
Discussion
最新的位置数据未做时间戳有效校验,最多返回20个
Declared In
DMKLocationAdapter.h
– currentWGS84Location
同步获取当前缓存的最新84坐标定位数据 建议使用时判断定位时间戳有效性
- (DMKLocation *)currentWGS84LocationDiscussion
同步获取当前缓存的最新84坐标定位数据 建议使用时判断定位时间戳有效性
Declared In
DMKLocationAdapter.h
– latestWGS84LocationsWithCount:
最新84坐标的位置数据未做时间戳有效校验,最多返回20个
- (NSArray<DMKLocation*> *)latestWGS84LocationsWithCount:(NSUInteger)countParameters
count |
要获取的个数,返回有可能小于count |
|---|
Discussion
最新84坐标的位置数据未做时间戳有效校验,最多返回20个
Declared In
DMKLocationAdapter.h
– requestLocationWithCompletionBlock:
异步获取单次当前定位数据
- (void)requestLocationWithCompletionBlock:(DMKLocatingCompletionBlock __nonnull)completionBlockParameters
completionBlock |
完成闭包,location为最新定位数据 location为nil表示失败,可从error获取详细信息 |
|---|
Discussion
异步获取单次当前定位数据
Declared In
DMKLocationAdapter.h
– requestWGS84LocationWithCompletionBlock:
异步获取84坐标系单次当前定位数据
- (void)requestWGS84LocationWithCompletionBlock:(DMKLocatingCompletionBlock __nonnull)completionBlockParameters
completionBlock |
完成闭包,location为最新定位数据 location为nil表示失败,可从error获取详细信息 |
|---|
Discussion
异步获取84坐标系单次当前定位数据
Declared In
DMKLocationAdapter.h
– currentHeading
同步获取当前缓存的最新方向数据 返回值为系统返回的原始数据
- (CLHeading *)currentHeadingDiscussion
同步获取当前缓存的最新方向数据 返回值为系统返回的原始数据
Declared In
DMKLocationAdapter.h
– headingDegrees
获取朝向角度信息 该信息针对系统返回CLHeading做过有效性处理
- (CGFloat)headingDegreesDiscussion
获取朝向角度信息 该信息针对系统返回CLHeading做过有效性处理
Declared In
DMKLocationAdapter.h
– pauseUpdatingLocationWithCallerId:
谨慎使用,一旦暂停任何业务都无法使用定位能力 暂停当前定位,业务注册的监听状态不会被改变,暂停接收系统定位更新
- (void)pauseUpdatingLocationWithCallerId:(NSString *__nonnull)callerIdParameters
callerId |
调用方标识(没有特殊要求可传调用方类名,或者自行拼接字符串) |
|---|
Discussion
谨慎使用,一旦暂停任何业务都无法使用定位能力 暂停当前定位,业务注册的监听状态不会被改变,暂停接收系统定位更新
Declared In
DMKLocationAdapter.h
– resumeUpdatingLocationWithCallerId:
恢复pause之前的状态,业务注册的监听状态不会被改变
- (void)resumeUpdatingLocationWithCallerId:(NSString *__nonnull)callerIdParameters
callerId |
调用方标识(没有特殊要求可传调用方类名,或者自行拼接字符串) |
|---|
Discussion
恢复pause之前的状态,业务注册的监听状态不会被改变
Declared In
DMKLocationAdapter.h
– enableNetLocation:
业务设置网络定位是否可用
- (void)enableNetLocation:(BOOL)enableDiscussion
业务设置网络定位是否可用
Declared In
DMKLocationAdapter.h
– stackInfoOnUpdateLocation
获取定位更新时缓存的堆栈信息
- (NSArray<NSString*> *)stackInfoOnUpdateLocationDiscussion
获取定位更新时缓存的堆栈信息
Declared In
DMKLocationAdapter.h
Other Methods
– checkLocationManagerBackgroundAbility
开启定位监听:当前配置和本次即将修改的不一样时开启,被暂停过的也不再处理
- (void)checkLocationManagerBackgroundAbilityDiscussion
开启定位监听:当前配置和本次即将修改的不一样时开启,被暂停过的也不再处理
Declared In
DMKLocationAdapter.m
– locationManagerDidFailWithError:
定位失败回调
- (void)locationManagerDidFailWithError:(nonnull NSError *)errorDiscussion
定位失败回调
Declared In
DMKLocationAdapter.m
– locationManagerDidUpdateLocation:
定位成功回调
- (void)locationManagerDidUpdateLocation:(CLLocation *)locationDiscussion
定位成功回调
Declared In
DMKLocationAdapter.m
– locationGCJ02DidUpdatePublish:
02坐标定位结果分发
- (void)locationGCJ02DidUpdatePublish:(DMKLocation *)locationDiscussion
02坐标定位结果分发
Declared In
DMKLocationAdapter.m
– locationWGS84DidUpdatePulish:
84坐标定位结果分发
- (void)locationWGS84DidUpdatePulish:(DMKLocation *)locationDiscussion
84坐标定位结果分发
Declared In
DMKLocationAdapter.m
– locationManagerDidUpdateHeading:
朝向变化回调
- (void)locationManagerDidUpdateHeading:(CLHeading *)newHeadingDiscussion
朝向变化回调
Declared In
DMKLocationAdapter.m
– locationManagerDidChangeAuthorizationStatus:
权限变化回调
- (void)locationManagerDidChangeAuthorizationStatus:(CLAuthorizationStatus)statusDiscussion
权限变化回调
Declared In
DMKLocationAdapter.m
– cacheLatestGCJ02Location:
缓存最新接收到的02位置信息到内存
- (void)cacheLatestGCJ02Location:(DMKLocation *)locationDiscussion
缓存最新接收到的02位置信息到内存
Declared In
DMKLocationAdapter.m
– cacheLatestWGS84Location:
缓存最新接收到的84位置信息到内存
- (void)cacheLatestWGS84Location:(DMKLocation *)locationDiscussion
缓存最新接收到的84位置信息到内存
Declared In
DMKLocationAdapter.m
Extension Methods
clientTable
容器:delegate地址字符串为key,DMKLocationClientModel为Value { @“delegate的address” : DMKLocationClientModel, }
@property (nonatomic, strong) NSMutableDictionary<NSString*DMKLocationClientModel*> *clientTableDiscussion
容器:delegate地址字符串为key,DMKLocationClientModel为Value { @“delegate的address” : DMKLocationClientModel, }
Declared In
DMKLocationAdapter.m
latestGCJ02Locations
缓存最新的GCJ02位置最大20条
@property (nonatomic, strong) NSMutableArray<DMKLocation*> *latestGCJ02LocationsDiscussion
缓存最新的GCJ02位置最大20条
Declared In
DMKLocationAdapter.m
latestWGS84Locations
缓存最新的WSG84位置最大20条
@property (nonatomic, strong) NSMutableArray<DMKLocation*> *latestWGS84LocationsDiscussion
缓存最新的WSG84位置最大20条
Declared In
DMKLocationAdapter.m
lastHeading
系统最后一次返回的方向数据
@property (atomic, strong) CLHeading *lastHeadingDiscussion
系统最后一次返回的方向数据
Declared In
DMKLocationAdapter.m
systemCurrentConfig
系统定位上次配置
@property (nonatomic, strong) DMKLocationSystemCurrentConfig *systemCurrentConfigDiscussion
系统定位上次配置
Declared In
DMKLocationAdapter.m
location_client_lock
操作业务容器同步锁
@property (nonatomic, strong) dispatch_semaphore_t location_client_lockDiscussion
操作业务容器同步锁
Declared In
DMKLocationAdapter.m
stackInfo
缓存的定位更新时的堆栈信息
@property (atomic, strong) NSArray<NSString*> *stackInfoDiscussion
缓存的定位更新时的堆栈信息
Declared In
DMKLocationAdapter.m
stackInfoUpdateTime
更新堆栈信息的时间戳
@property (nonatomic, strong) NSDate *stackInfoUpdateTimeDiscussion
更新堆栈信息的时间戳
Declared In
DMKLocationAdapter.m
Authorization Methods
+ locationServicesEnabled
获取系统隐私-定位服务全局开关状态
+ (BOOL)locationServicesEnabledDiscussion
获取系统隐私-定位服务全局开关状态
Declared In
DMKLocationAdapter+Authorization.h
+ locationAuthorizationEnabled
获取当前是否是授权状态
+ (BOOL)locationAuthorizationEnabledDiscussion
获取当前是否是授权状态
Declared In
DMKLocationAdapter+Authorization.h
+ authorizationStatus
获取当前系统定位权限
+ (CLAuthorizationStatus)authorizationStatusDiscussion
获取当前系统定位权限
Declared In
DMKLocationAdapter+Authorization.h
+ checkFullAccuracyAuthorization
获取定位精度等级:
+ (DMKAccuracyAuthorizationType)checkFullAccuracyAuthorizationDiscussion
获取定位精度等级:
Declared In
DMKLocationAdapter+Authorization.h
+ requestAuthorization
请求获取APP应用中的定位权限
+ (void)requestAuthorizationDiscussion
请求获取APP应用中的定位权限
Declared In
DMKLocationAdapter+Authorization.h
+ requestAuthorizationWithMeessage:container:
展示定位权限引导设置弹窗
+ (void)requestAuthorizationWithMeessage:(NSString *__nullable)message container:(UIViewController *)vcParameters
message |
自定义弹框文案,未设置使用默认文案 |
|---|---|
vc |
展示容器页面 |
Discussion
展示定位权限引导设置弹窗
Declared In
DMKLocationAdapter+Authorization.h
+ requestFullAccuracyAuthorizationWithMeessage:container:
展示高精度引导视图
+ (void)requestFullAccuracyAuthorizationWithMeessage:(NSString *__nullable)message container:(UIViewController *)vcParameters
message |
自定义弹框文案,未设置使用默认文案 |
|---|---|
vc |
展示容器页面 |
Discussion
展示高精度引导视图
Declared In
DMKLocationAdapter+Authorization.h