Heim > Fragen und Antworten > Hauptteil
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLocation *cation =[locations objectAtIndex:0];
NSLog(@"纬度--%f",cation.coordinate.latitude);
NSLog(@"经度--%f",cation.coordinate.longitude);
[self.locationManager stopUpdatingLocation];//停止更新位置
}
大家讲道理2017-04-17 14:21:15
这不是百度的,百度的是- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
百度底层会调用那些CL开头的方法,所有是有值的,建议删掉交给百度SDK处理
你只用调取- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
ringa_lee2017-04-17 14:21:15
楼主,此didUpdateLocations代理方法,是会调用多次的,因为定位的时候,如果手机移动的话,经纬度也会跟着变化,此方法就是随之改变的经纬度
我做百度地图的时候定位需求没用到-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
以下几种
- (void)mapViewWillStartLocatingUser:(BMKMapView *)mapView
- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
- (void)mapViewDidStopLocatingUser:(BMKMapView *)mapView