iOS 跳转到地图App后的各种操作

这里不给出相关的代码,只是给我了在解决问题是参考的网址。

跳转到各个地图的参考官方网址
调用百度地图App

http://developer.baidu.com/map/wiki/index.php?title=uri/api/ios

百度地图
http://lbsyun.baidu.com/index.php?title=uri/api/ios

高德地图
http://lbs.amap.com/api/uri-api/guide/ios-uri-explain/navi/

苹果地图
https://developer.apple.com/reference/mapkit/mkmapitem

腾讯地图

http://lbs.qq.com/uri_v1/guide-route.html

腾讯地图的导航

NSString *urlStr = [NSString stringWithFormat:@”qqmap://map/routeplan?type=drive&fromcoord=%f,%f&tocoord=%f,%f&policy=1”,star_wd,star_jd,end_wd,end_jd];

NSURL *r = [NSURL URLWithString:urlStr];
[[UIApplication sharedApplication] openURL:r];

百度地图的导航

注意:遇到中文的时候必须编码

double wd = self.investViewModel.zhouBianModel.map_dh_wd.doubleValue;
double jd = self.investViewModel.zhouBianModel.map_dh_jd.doubleValue;
double m_wd = _locService.userLocation.location.coordinate.longitude;
double m_jd = _locService.userLocation.location.coordinate.latitude;
NSString * name = self.investViewModel.zhouBianModel.title;
NSString *urlString = [[NSString stringWithFormat:@”baidumap://map/direction?origin=latlng:%f,%f|name:我的位置&destination=latlng:%f,%f|name:%@&mode=driving”,m_wd,m_jd,wd,jd,name]stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ;
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];

跳转到百度地图携带要搜索的地方,到百度界面直接是搜索结果界面

if([url rangeOfString:@”https://map.baidu“].location != NSNotFound){

     NSString * str = [NSString stringWithFormat:@"baidumap://map/geocoder?address=%@&src=webapp.geo.to-dream.H5Demo",address] ;

    NSURL *r = [NSURL URLWithString:str];
     [[UIApplication sharedApplication] openURL:r];

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值