如下代码:
- (void)viewDidLoad {
[super viewDidLoad];
_mapView = [[BMKMapView alloc] initWithFrame:[UIScreen mainScreen].bounds];
if ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0) {
// 主动请求权限
self.mgr = [[CLLocationManager alloc] init];
self.mgr.delegate = self;
[self.mgr requestAlwaysAuthorization];
}
_mapView.showsUserLocation = YES;
[self.view addSubview:_mapView];
_locationService = [[BMKLocationService alloc] init];
[_locationService startUserLocationService];
NSLog(@"%f,%f",_locationService.userLocation.location.coordinate.latitude,_locationService.userLocation.location.coordinate.longitude);
}
只能显示地图,但是不能定位到当前位置。
输出当前位置的坐标是(0,0)
- (void)viewDidLoad {
[super viewDidLoad];
_mapView = [[BMKMapView alloc] initWithFrame:[UIScreen mainScreen].bounds];
if ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0) {
// 主动请求权限
self.mgr = [[CLLocationManager alloc] init];
self.mgr.delegate = self;
[self.mgr requestAlwaysAuthorization];
}
_mapView.showsUserLocation = YES;
[self.view addSubview:_mapView];
_locationService = [[BMKLocationService alloc] init];
[_locationService startUserLocationService];
NSLog(@"%f,%f",_locationService.userLocation.location.coordinate.latitude,_locationService.userLocation.location.coordinate.longitude);
}
只能显示地图,但是不能定位到当前位置。
输出当前位置的坐标是(0,0)

