amap_139****028 发表于 2015-11-24 12:41:18

iOS一次定位和多次定位都失败

上周使用的还是iOS1.0.0SDK的一次定位,而且正常,这周突然发现定位出了问题,检查获取到的地理位置为空,错误信息是:Error Domain=AMapLocationErrorDomain Code=5 "取消" UserInfo={NSLocalizedDescription=取消}




更改为多次定位后
1.- (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error;
2.- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location;
这两个代理方法都没走

mlfgaode 发表于 2015-11-26 17:53:33

你设置代理了吗?没设置self,怎么可能走代理方法。

chenjie_1986 发表于 2015-12-11 14:49:35

设置代理了吗?

uroaddev 发表于 2015-12-18 16:35:04

也遇到同样的问题,单次定位提示error为取消,但在使用delegate多次定位,有写delegate,没有回调。

appleliubo 发表于 2015-12-23 11:49:33

不要搞成局部局部变量,亲~

AMapLocationManager被释放的时候,自然会cancel掉~

amap_135****143 发表于 2016-3-4 23:46:12

发帖都发不了 只能插楼了!!!!
关闭定位无效 v3.3.0
self.mapView.showsUserLocation = NO;没有作用
在两个界面都显示了地图设置无效

至于sdk版本 我是直接pod安装的 没有写版本号,所以就是最新的版本



部分代码:
@property (nonatomic,weak) MAMapView * mapView;//地图
-(MAMapView *)mapView{
    if (!_mapView) {
      MAMapView * mapview = [initWithFrame:self.view.bounds];
      mapview.delegate = self;
      mapview.showsScale = NO;
      _mapView.showsUserLocation = YES;
      _mapView.userTrackingMode = MAUserTrackingModeNone;
      _mapView = mapview;
      _mapView.zoomLevel = 19;
      _mapView.showsCompass = NO;
    }
    return _mapView;
}

在定位中 关闭无效
-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation
updatingLocation:(BOOL)updatingLocation
{
    if(updatingLocation)
    {
      self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate;

      //取出当前位置的坐标
      NSLog(@"当前位置:latitude : %f,longitude: %f",userLocation.coordinate.latitude,userLocation.coordinate.longitude);
      CLLocation * cll = [ initWithLatitude:self.mapView.userLocation.location.coordinate.latitude longitude:self.mapView.userLocation.location.coordinate.longitude];

      CLGeocoder *clGeoCoder = [ init];
      [clGeoCoder reverseGeocodeLocation:cll completionHandler: ^(NSArray *placemarks,NSError *error) {
            CLPlacemark *placeMark = ;

            NSDictionary *addressDic=placeMark.addressDictionary;

            //      NSString *state=;//省
            self.city =;//市
            //      NSString *subLocality=;//区
            //      NSString *street=;//街道

            self.mapView.showsUserLocation = NO;

      }];
    }

}

望解决!!!没辙了 不然也不会这个点发!!!!!

chevalier528 发表于 2016-3-7 10:43:49

定位结束以后 断点试一下self.mapView.showsUserLocation = NO;有调用么?

amap_183****680 发表于 2016-4-26 21:43:29

楼主, 问题解决了吗., 我的一次定位, 第一次定位成功, 后来的同样的代码都没有成功

amap_137****734 发表于 2017-8-1 16:02:47

请问大神怎样才能手机号码基站定位?
页: [1]
查看完整版本: iOS一次定位和多次定位都失败