iOS打开百度地图高德地图导航
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS打开百度地图高德地图导航相关的知识,希望对你有一定的参考价值。
- BOOL hasBaiduMap = NO;
- BOOL hasGaodeMap = NO;
- if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"baidumap://map/"]]){
- hasBaiduMap = YES;
- }
- if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"iosamap://"]]){
- hasGaodeMap = YES;
- }
- if ([@"使用百度地图导航" isEqualToString:title])
- {
- NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/direction?origin=latlng:%f,%f|name:我的位置&destination=latlng:%f,%f|name:终点&mode=driving",currentLat, currentLon,_shopLat,_shopLon] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ;
- [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
- }
- else if ([@"使用高德地图导航" isEqualToString:title])
- {
- NSString *urlString = [[NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&backScheme=%@&poiname=%@&lat=%f&lon=%f&dev=1&style=2",@"app name", yourscheme, @"终点", _shopLat, _shopLon] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
- }
以上是关于iOS打开百度地图高德地图导航的主要内容,如果未能解决你的问题,请参考以下文章