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

查看: 2479|回复: 8
打印 上一主题 下一主题

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

[复制链接]
最佳答案
0 

1

主题

2

帖子

17

积分

新手上路

Rank: 1

积分
17
楼主
发表于 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;

        }];
    }

}

望解决!!!没辙了 不然也不会这个点发!!!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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