地图标注 坐标转换 找不到so INVALID_USER_KEY INVALID_USER_SCODE
1、适配iOS14定位权限相关:
新增定位模式属性;@property (nonatomic, assign) AMapLocationAccuracyModelocationAccuracyModeAPI_AVAILABLE(ios(14.0));
typedefNS_ENUM(NSInteger, AMapLocationAccuracyMode) {
AMapLocationFullAndReduceAccuracy = 0,
AMapLocationFullAccuracy,
AMapLocationReduceAccuracy
};
设置选项 | doRequireTemporaryFullAccuracyAuth | 异常/定位数据回调 |
AMapLocationFullAndReduceAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则依然开启定位,回调模糊定位 |
AMapLocationFullAccuracy | 会触发申请临时精确定位回调 | 如果未获得精确定位权限,则不开启定位,回调error |
AMapLocationReduceAccuracy | 不会触发申请临时精确定位回调 | 根据当前定位精度权限,回调定位数据 |
新增获取当前定位精度权限;@property (nonatomic, readonly) CLAccuracyAuthorization currentAuthorizationAPI_AVAILABLE(ios(14.0));
新增申请临时精确定位权限回调;- (void)amapLocationManager:(AMapLocationManager *)manager doRequireTemporaryFullAccuracyAuth:(CLLocationManager*)locationManager completion:(void(^)(NSError *error))completion;
触发前提条件:1、plist配置NSLocationTemporaryUsageDescriptionDictionary。2、locationAccuracyMode设置为AMapLocationFullAndReduceAccuracy/AMapLocationFullAccuracy。3、当前用户已授权过定位权限,且为模糊定位权限。
触发时机:满足前提条件时,再次发起定位请求会调用代理的此方法。
具体实现:此方法实现调用申请临时精确定位权限API即可:
-(void)amapLocationManager:(AMapLocationManager*)managerdoRequireTemporaryFullAccuracyAuth:(CLLocationManager*)locationManagercompletion:(void(^)(NSError*_Nullable))completion
{
if(@available(iOS14.0,*)){
[locationManager requestTemporaryFullAccuracyAuthorizationWithPurposeKey:@"AMapLocationScene" completion:^(NSError*_Nullableerror) {
if(completion){
completion(error);
}
}];
}
}