美文网首页
iOS调用百度地图(一)(显示到大西洋的原因)

iOS调用百度地图(一)(显示到大西洋的原因)

作者: LiuffSunny | 来源:发表于2019-07-31 22:26 被阅读0次

    基础的调用定位的方法

    -(void)viewDidLoad
    { 
    //初始化BMKLocationService 
    _locService = [[BMKLocationService alloc]init]; 
    _locService.delegate = self; 
    //启动LocationService 
    [_locService startUserLocationService]; 
    } 
    //实现相关delegate 处理位置信息更新 
    //处理方向变更信息 
    - (void)didUpdateUserHeading:(BMKUserLocation *)userLocation 
    { 
    //NSLog(@"heading is %@",userLocation.heading); 
    } 
    //处理位置坐标更新 
    - (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation 
    { 
    //NSLog(@"didUpdateUserLocation lat %f,long %f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude); 
    }
    

    1.如果使用了iOS模拟器,默认会定位到美国(可以在Xcode中更改)

    一、选中模拟器:Debug - Location - Custom Location


    20171108144855558.png

    二、弹出的纬经度坐标、纬经度、纬经度坐标,默认显示的是苹果的官方坐标


    20171108145613311.png

    2.检查接收到的经纬度为字符串是否成功转化为正确的经纬度格式(Double类型)
    3.检查经纬度是否传反了
    4.检查经纬度是否为0

    ***234均有可能定位到大西洋,需要自己排除下

    相关文章

      网友评论

          本文标题:iOS调用百度地图(一)(显示到大西洋的原因)

          本文链接:https://www.haomeiwen.com/subject/ndwxdctx.html