https://www.jianshu.com/p/691dd39cb28c

【ios调起 地图app】分三步:

1、配置相对于地图app的LSApplicationQueriesSchemes白名单

  • 百度地图:baidumap
  • 高德地图:iosamap
  • 腾讯地图:qqmap
  • 苹果地图:http://maps.apple.com/

2.判断是否能打开第三方地图

    //判断是否能打开百度地图
NSURL * baidu_App = [NSURL URLWithString:@"baidumap://"];
if ([[UIApplication sharedApplication] canOpenURL:baidu_App]) { } //判断是否能打开高德地图
NSURL * gaode_App = [NSURL URLWithString:@"iosamap://"];
if ([[UIApplication sharedApplication] canOpenURL:gaode_App]) { } //判断是否能打开苹果地图
NSURL * apple_App = [NSURL URLWithString:@"http://maps.apple.com/"];
if ([[UIApplication sharedApplication] canOpenURL:apple_App]) {
[alert addAction:appleAction];
}

3.传经纬度调起地图导航

  • 百度地图

        NSURL * baidu_App = [NSURL URLWithString:@"baidumap://"];
    if ([[UIApplication sharedApplication] canOpenURL:baidu_App]) {
    // 如果集成的是百度地图就需要用bd09ll否则gcj02
    bdString = [[NSString stringWithFormat:@"baidumap://map/direction?origin={{我的位置}}&destination=latlng:%@,%@|name:%@&coord_type=bd09ll&mode=driving&src=ios.blackfish.XHY",Latitude,Longitude,adderss] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:bdString] options:@{} completionHandler:nil];
    }
  • 高德地图
  •     NSURL * gaode_App = [NSURL URLWithString:@"iosamap://"];
    if ([[UIApplication sharedApplication] canOpenURL:gaode_App]) { //将BD-09坐标系转换为GCJ-02坐标系
    CLLocationCoordinate2D location = [JZLocationConverter bd09ToGcj02:CLLocationCoordinate2DMake([Latitude doubleValue], [Longitude doubleValue])]; gdString = [[NSString stringWithFormat:@"iosamap://path?sourceApplication=ios.blackfish.XHY&dlat=%f&dlon=%f&dname=%@&style=2&dev=0",latitude,longitude,adderss] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; //先出现地点位置,然后再手动点击导航
    }
  • 腾讯地图
  • 可考虑
  • //调起腾讯地图APP,并在图上标注位置 qqmap://map/marker?marker=coord:39.892326,116.342763;title:超好吃冰激凌;addr:手帕口桥北铁路道口&referer=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77
//腾讯地图
- (void)qqMap{ CLLocationCoordinate2D gcj02Coord = CLLocationCoordinate2DMake(百度坐标, 百度坐标); float shopLat = gcj02Coord.latitude;
float shoplng = gcj02Coord.longitude; NSString *urlString = [NSString stringWithFormat:@"qqmap://map/routeplan?type=bus&fromcoord=%f,%f&from=我的位置&referer=jikexiu",self.userLocation.location.coordinate.latitude, self.userLocation.location.coordinate.longitude]; urlString = [NSString stringWithFormat:@"%@&tocoord=%f,%f&to=%@",urlString, shopLat, shoplng, _orderModel.addressStr]; urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:^(BOOL success) { }];
}
  • 苹果地图
  •     NSURL * apple_App = [NSURL URLWithString:@"http://maps.apple.com/"];
    if ([[UIApplication sharedApplication] canOpenURL:apple_App]) {
    //将BD-09坐标系转换为GCJ-02坐标系
    CLLocationCoordinate2D location = [JZLocationConverter bd09ToGcj02:CLLocationCoordinate2DMake([Latitude doubleValue], [Longitude doubleValue])]; MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
    MKMapItem *tolocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:location addressDictionary:nil]];
    tolocation.name = adderss;
    [MKMapItem openMapsWithItems:@[currentLocation,tolocation] launchOptions:@{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
    MKLaunchOptionsShowsTrafficKey:[NSNumber numberWithBool:YES]}];
    }

拓展:

安卓调用

if(outSysType == 10504){// 安卓  10504
switch(mapType) {
case 'tecentMap':
url = 'qqmap://map/routeplan?type=drive&from=&fromcoord=&to='+ title +'&tocoord=' + lat + ',' + lng + '&policy=0&referer=kgjhapp';
break;
case 'gaodeMap':
url = 'androidamap://route?sourceApplication=appName&slat=&slon=&sname=&dlat='+ lat + '&dlon='+ lng+'&dname='+title+'&dev=0&t=2';
break;
case 'baiduMap':
url = 'bdapp://map/direction?destination='+lat+','+lng+'&coord_type=gcj02&mode=driving&src=com.knssshy.sj';
break;
default:
break;
}
}

H5调用

  switch(mapType) {
case 'tecentMap':
url = 'https://apis.map.qq.com/uri/v1/marker?marker=coord:' + lat + ',' + lng +';addr:'+ address +';title:'+ title + '&referer=keyfree';
break;
case 'gaodeMap':
url = 'https://uri.amap.com/marker?position='+ lng + ',' + lat +'&name='+ address +'&callnative=1';
break;
case 'baiduMap':
url = 'http://api.map.baidu.com/marker?location=' + lat + ',' + lng +'&title='+ title + '&content='+ address +'&output=html&src=webapp.reformer.appname&coord_type=gcj02';
break;
default:
break;
}

ios打开第三方地图app的更多相关文章

  1. iOS调用第三方地图App进行导航方法

    前言 App内根据手机上装载的地图App将其显示在弹出的选择框,选择对应地图跳转进入地图导航.需要用到- (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS( ...

  2. Android和IOS启动第三方地图APP

    最近客户新提了需求,地址字段要能通过第三方的地图进行定位,于是对Android和IOS端进行了调整. 以下是调用地图部分的代码. android可按照包名来判断app是否存在: 方法: /* * ch ...

  3. ionic3 应用内打开第三方地图导航 百度 高德

    1.安装检测第三方APP是否存在的插件 cordova plugin add cordova-plugin-appavailability --save npm install --save @ion ...

  4. uni-app路径规划(打开第三方地图实现)

    百度网盘链接:https://pan.baidu.com/s/1-Ys13GFcnKXB1wkJotcwMw 提取码:16gp 把js文件放在common目录下 引入:    import pathP ...

  5. iOS 调用第三方地图进行导航

    //支持的地图 { _model = model; //支持的地图 NSMutableArray *maps = [NSMutableArray array]; //苹果原生地图-苹果原生地图方法和其 ...

  6. iOS打开百度地图、高德地图导航

    1.判断手机里是否已经安装了百度地图或者高德地图: BOOL hasBaiduMap = NO; BOOL hasGaodeMap = NO; if ([[UIApplication sharedAp ...

  7. 如何实现在H5里调起高德地图APP?(下)

    这一篇文章将告诉您,如果直接打开高德地图APP,并展示路线规划.适合有定位的移动设备,可以查询到从“我的位置”到目的地的路径规划,并直接导航. 场景二.调起高德地图的路线规划功能 导航是目前JSAPI ...

  8. 如何实现在H5里调起高德地图APP?

    http://www.cnblogs.com/milkmap/p/5912350.html 这一篇文章,将讲述如何在H5里调起高德地图APP,并展示兴趣点.适合于展示某个餐馆,商场等,让用户自行选择前 ...

  9. 如何实现在H5里调起高德地图APP

    这一篇文章将告诉您,如果直接打开高德地图APP,并展示路线规划.适合有定位的移动设备,可以查询到从“我的位置”到目的地的路径规划,并直接导航. 场景二.调起高德地图的路线规划功能 导航是目前JSAPI ...

  10. Android 打开高德地图、百度地图进行导航;打开第三方App去导航;

    抽成工具类了,复制下来就能直接用了,直接看代码吧: 高德地图Url Api: http://lbs.amap.com/api/amap-mobile/guide/android/navigation ...

随机推荐

  1. 亲测有效! Super PhotoCut Pro 超级抠图工具 V2.8.8 for mac 破解版

    亲测有效! Super PhotoCut Pro 超级抠图工具 V2.8.8 for mac  破解版 Super PhotoCut 是一款专业的,非常易于使用的图片抠图工具.它能够准确地覆盖你想要去 ...

  2. Channel和Stream的单双向问题

    stream分为input和output,为单向. channel为双向,可以write也可以read,但是通过inputstream或者outputstream获取的channle并不能实现双向的数 ...

  3. C#操作注册表简单教程(附带操作某数据库客户端注册表以实现重置试用期的效果)

    前言: 使用Windows系统,经常会遇到需要做注册表的操作.例如,一些软件需要修改注册表.自己编写的软件需要新建注册表进行写入注册信息等等.以下内容以某常见的数据库操作客户端为例,做一个注册表操作的 ...

  4. JZOJ 1967.【2011集训队出题】聪聪可可

    题目 [2011集训队出题]聪聪可可 思路 看看做做 阴阳 这道题 极力推荐 自从做了这道题后,这些题就变成秒切的题了 很容易想到求节点到分治中心的距离,然后 \(\bmod 3\) 那么在求根节点一 ...

  5. win11 文件夹内关闭显示更多

    使用命令提示符 打开cmd窗口,输入  reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\Inpro ...

  6. CMSIS

    百度百科-CMSIS CMSIS 编辑 ARM Cortex 微控制器软件接口标准(CMSIS:Cortex Microcontroller Software Interface Standard) ...

  7. classmethod 修饰符

    title: Python classmethod 修饰符 author: 杨晓东 permalink: classmethod date: 2021-10-02 11:27:04 categorie ...

  8. 在grafana中使用不同的数据源及插件安装

    一.postgresql作为数据源 现在PG的版本是10.5(10+) 加入datasource 时只能指定一个数据库,对于监控来说可使用默认数据库postgres! 可以方便地作趋势图以及使用tab ...

  9. 360 quake 网络空间测绘引擎真的很不错

    最近通过使用360 quake搜索引擎,发现真的能够比较准确的找到数据,对比fofa,shodan这种免费用户使用体验真的很好,搜到的数据很是全面,但是搜索的资产是国内的ip时会做脱敏处理.有时间大家 ...

  10. RDD编程练习

    一.filter,map,flatmap练习: 1.读文本文件生成RDD lines 2.将一行一行的文本分割成单词 words 3.全部转换为小写 4.去掉长度小于3的单词 5.去掉停用词 6.练习 ...