当前位置:网站首页>Gaode positioning - the problem that the permission pop-up box does not appear
Gaode positioning - the problem that the permission pop-up box does not appear
2022-07-23 12:04:00 【Try to be a charterer】
The positioning pop-up box is not prompted
Recently, I am optimizing the old projects of the company , It is found that there is no prompt in the location permission pop-up box in the project .
At first I thought it was plist There is no configuration in the file , Just reconfigure , The three permissions marked in the red box in the following picture are all about location configuration .
Generally, we use the third permission : stay APP Get location information during use . prevent APP The audit was rejected due to location permission

After configuring these, write according to the normal process in the official document .
1、 Gaode first SDK Import the project ( There are specific methods in the official documents ).
2、 Import header problems into the project
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapLocationKit/AMapLocationKit.h>
3、 initialization
self.GlocationManager = [[AMapLocationManager alloc] init]; // initialization
self.GlocationManager.delegate = self; // Implementing agents
self.GlocationManager.desiredAccuracy = kCLLocationAccuracyBest; // Positioning accuracy
self.GlocationManager.distanceFilter = 50; // Locate the minimum update distance
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
self.GlocationManager.allowsBackgroundLocationUpdates = YES;
}
[self.GlocationManager setLocatingWithReGeocode:YES];
[self.GlocationManager startUpdatingLocation];
4、 Implementing agent methods
This is the problem that the pop-up box does not appear , Before running, there was always no pop-up , Warning tips
" To be in iOS 8 And above versions use background location services , Need to achieve amapLocationManager:doRequireLocationAuth: Proxy method "
In the project, there is no pop-up box because this method has not been added and implemented , Then add this method , Run again and the prompt box will pop up successfully .
- (void)amapLocationManager:(AMapLocationManager *)manager doRequireLocationAuth:(CLLocationManager*)locationManager{
[locationManager requestWhenInUseAuthorization];// Use location information during project use Replaceable
}
- (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(@" Current address information :%@%@%@%@%@%@", reGeocode.province,reGeocode.city,reGeocode.district,reGeocode.street,reGeocode.number,reGeocode.AOIName);
}
}
Sum up , If your project is such a problem , You can refer to this method .
边栏推荐
猜你喜欢
随机推荐
Upload pictures to qiniu cloud through the web call interface
DBA command
虚函数
修改mysql的root密码
对.h5文件的迭代显示,h5py数据操作
Interpretation of yolov3 key code
百变冰冰!使用飞桨的PaddleGAN实现妆容迁移
MySQL索引
MySQL index
New BPMN file used by activiti workflow
paddle.nn.BCELoss的使用问题
Résumé des connaissances mathématiques communes
Develop necessary idea use
双端队列
Mosaic the face part of the picture
打印直角三角型、等腰三角型、菱形
飞桨高层API实现图像去雨
3.1、对DQL简化补充
Introduction to the process structure used by activiti workflow
Notes | (station B) Adult Liu: pytorch deep learning practice (code detailed notes, suitable for zero Foundation)









