- 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]];
- }
时间: 2024-10-16 18:07:16