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

来源:互联网 发布:分布式数据库 hadoop 编辑:程序博客网 时间:2024/06/01 09:53

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

跳转到各个地图的参考官方网址
调用百度地图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 0
原创粉丝点击