自2018年10月18日起,高德开发者论坛除车机板块外,其他板块将停止发帖与维护,如您有使用问题请 提交工单 联系我们,感谢您的理解。

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

查看数: 2477 | 评论数: 8 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-11-24 12:41

正文摘要:

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

回复

amap_1370274734 发表于 2017-8-1 16:02:47
请问大神怎样才能手机号码基站定位?
amap_1831751680 发表于 2016-4-26 21:43:29
楼主, 问题解决了吗., 我的一次定位, 第一次定位成功, 后来的同样的代码都没有成功
chevalier528 发表于 2016-3-7 10:43:49
定位结束以后 断点试一下self.mapView.showsUserLocation = NO;有调用么?
amap_1355497143 发表于 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 = [[MAMapView alloc]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)mapViewMAMapView *)mapView didUpdateUserLocationMAUserLocation *)userLocation
updatingLocationBOOL)updatingLocation
{
    if(updatingLocation)
    {
        self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate;

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

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

            NSDictionary *addressDic=placeMark.addressDictionary;

            //        NSString *state=[addressDic objectForKey"State"];//省
            self.city =[addressDic objectForKey"City"];//市
            //        NSString *subLocality=[addressDic objectForKey"SubLocality"];//区
            //        NSString *street=[addressDic objectForKey"Street"];//街道

            self.mapView.showsUserLocation = NO;

        }];
    }

}

望解决!!!没辙了 不然也不会这个点发!!!!!
appleliubo 发表于 2015-12-23 11:49:33
不要搞成局部局部变量,亲~

AMapLocationManager被释放的时候,自然会cancel掉~
uroaddev 发表于 2015-12-18 16:35:04
也遇到同样的问题,单次定位提示error为取消,但在使用delegate多次定位,有写delegate,没有回调。
chenjie_1986 发表于 2015-12-11 14:49:35
设置代理了吗?
mlfgaode 发表于 2015-11-26 17:53:33
你设置代理了吗?没设置self,怎么可能走代理方法。

Archiver|小黑屋|高德开发者论坛

Copyright ©2014 高德开发者论坛.All Rights Reserved |京ICP证070711号

意见反馈 常见问题 服务条款 联系我们
快速回复 返回顶部 返回列表