|
发表帖子
API/SDK版本号: |
AMap3DMap (3.3.1) |
产品: |
定位 |
手机型号: |
iOS 9.2 |
使用接口: |
|
各位大神,我这里有个问题,按照官方文档学习的,就是一个简单的定位功能,但是定位的不准,找不到是什么原因,代码很简单,就这么几行- #import "ViewController.h"
- #import <MAMapKit/MAMapKit.h>
- #define LBS_AMAP_KEY @"1234567890"
- @interface ViewController ()<MAMapViewDelegate>
- {
- MAMapView *mapView;
- }
- @end
- @implementation ViewController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
- [self initMapView];
- }
- - (void)initMapView
- {
- [MAMapServices sharedServices].apiKey = LBS_AMAP_KEY;
- mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
- mapView.delegate = self;
- [self.view addSubview:mapView];
- mapView.showsUserLocation = YES;
- }
- - (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation
- {
- CLLocation *currentLocation = userLocation.location;
-
- NSLog(@"latitude:%f--------longitude:%f", currentLocation.coordinate.latitude, currentLocation.coordinate.longitude);
- }
- @end
复制代码 info.plist中也配置了NSLocationWhenInUseUsageDescription,最后打印的经纬度信息就是不对,能不能帮我看看是怎么回事?
|
|