当前位置:网站首页>高德定位---权限弹框不出现的问题
高德定位---权限弹框不出现的问题
2022-07-23 05:41:00 【努力成为包租婆】
定位弹框不提示了
最近在优化公司以前的老项目,发现项目里面定位权限弹框没有提示。
刚开始以为是plist文件里面没有配置,就重新进行一次配置,下面图片里面红色框里面标出来的三个权限都是关于位置的配置。
一般情况我们使用的权限是第三个:在APP使用期间获取位置信息。防止APP审核因为位置权限问题被拒

配置好这些之后就按照官方文档里面的正常流程进行编写。
1、先将高德SDK导入项目(官方文档里面有具体的方法)。
2、项目里面导入头问题件
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapLocationKit/AMapLocationKit.h>
3、初始化
self.GlocationManager = [[AMapLocationManager alloc] init]; // 初始化
self.GlocationManager.delegate = self; // 实现代理
self.GlocationManager.desiredAccuracy = kCLLocationAccuracyBest; // 定位精度
self.GlocationManager.distanceFilter = 50; // 定位最小更新距离
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
self.GlocationManager.allowsBackgroundLocationUpdates = YES;
}
[self.GlocationManager setLocatingWithReGeocode:YES];
[self.GlocationManager startUpdatingLocation];
4、实现代理方法
弹框不出现的问题就是这里了,之前运行的时候总是不弹框,警告提示
" 要在iOS 8及以上版本使用后台定位服务, 需要实现amapLocationManager:doRequireLocationAuth: 代理方法"
项目里面就是因为这个方法没有添加实现才没弹框的,之后添加进去这个方法,再次运行就成功弹出提示框了。
- (void)amapLocationManager:(AMapLocationManager *)manager doRequireLocationAuth:(CLLocationManager*)locationManager{
[locationManager requestWhenInUseAuthorization];// 项目使用期间使用位置信息 可以更换
}
- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode
{
NSLog(@"location:{lat:%f; lon:%f; accuracy:%f}", location.coordinate.latitude, location.coordinate.longitude, location.horizontalAccuracy);
if (reGeocode)
{
NSLog(@"当前地址信息:%@%@%@%@%@%@", reGeocode.province,reGeocode.city,reGeocode.district,reGeocode.street,reGeocode.number,reGeocode.AOIName);
}
}
综上,如果你的项目是这样的问题,就可以参考一下这个方法。
边栏推荐
- 数仓4.0笔记——数仓环境搭建—— Yarn配置
- Image fuzzy processing batch production fuzzy data set
- mysql根据中文字段首字母排序
- mysql树形结构递归查询
- Customized development of ant chain NFT digital collection DAPP mall system
- [untitled]
- 按照日期进行累加sql
- MySQL数据库
- mysql免密登录设置
- Unable to negotiate with port 51732: no matching host key type found. Their offer:
猜你喜欢

Method of recognizing b value from DICOM tag in DWI image

Fed Brad: last week's employment report showed that the U.S. economy is robust and can withstand higher interest rates
![[doris] configure and basically use the contents system (continue to add content when you have time)](/img/74/21c5c0866ed6b1bb6f9a1e3755b61e.png)
[doris] configure and basically use the contents system (continue to add content when you have time)

Development of digital collection system: enterprise layout meta universe digital collection

NFT数字藏品平台开发搭建,源码开发数字藏品

NFT digital collection system development: Shenzhen Evening News "good times travel" digital collection online seconds chime

数仓4.0笔记——用户行为数据采集一

mysql免密登录设置

Project instances used by activiti workflow

quartz2.2简单调度Job
随机推荐
mysql免密登录设置
数字藏品系统开发:企业布局元宇宙数字藏品
Scala II process control
[hudi]hudi compilation and simple use of Hudi & spark and Hudi & Flink
Installation and process creation of activiti app used by activiti workflow
Data warehouse 4.0 notes - user behavior data collection II
phxpaxos安装编译流程
[pyautogui learning] screen coordinates and mouse scrolling
Data warehouse 4.0 notes - user behavior data generation
[literature research] search PubMed for papers in journals with specific impact factors
DBA命令
数仓4.0笔记——业务数据采集
NFT数字藏品系统开发:深圳晚报《美好时光遨游记》数字藏品上线秒磬
activiti7快速入门经验分享
Unable to negotiate with port 51732: no matching host key type found. Their offer:
八、集合框架和泛型
[metric] use Prometheus to monitor flink1.13org.apache.flink.metrics
编译原理-语法分析详解
1、MySQL初体验
Unable to negotiate with port 51732: no matching host key type found. Their offer: