在你项目的info.plist添加 LSApplicationQueriesSchemes 为KEY 类型为NSArray;添加对应的白名单

高德:iosamap百度:baidumap

- (void)click:(UIButton*)button{

// 百度地图与高德地图、苹果地图采用的坐标系不一样,高德和苹果只能用地名不能用后台返回的坐标

CGFloatlatitude  =36.547901;  // 纬度

CGFloatlongitude  =104.258354;// 经度

self.address = [[NSString alloc] init];

CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:(CLLocationDegrees)longitude];

CLGeocoder * geocoder = [[CLGeocoder alloc]init];

[geocoderreverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {

if(error ==nil&& [placemarkscount] >0) {

//这时的placemarks数组里面只有一个元素

CLPlacemark* placemark = [placemarksfirstObject];

NSLog(@"%@",placemark.addressDictionary); //根据经纬度会输出该经纬度下的详细地址  国家 地区 街道

self.address = [NSString stringWithFormat:@"%@",placemark.addressDictionary[@"FormattedAddressLines"][0]] ;

[self openAlert];

}

}];

}

- (void)openAlert{

CGFloatlatitude  =36.547901;  // 纬度

CGFloatlongitude  =104.258354;

CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:(CLLocationDegrees)longitude];

// 打开地图的优先级顺序:百度地图->高德地图->苹果地图

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]]) {

// 百度地图

// 起点为“我的位置”,终点为后台返回的坐标

NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/direction?origin={{我的位置}}&destination=%f,%f&mode=riding&src=%@", latitude, longitude,self.address] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL*url = [NSURLURLWithString:urlString];

[[UIApplication sharedApplication] openURL:url];

}else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"iosamap://"]]) {

// 高德地图

// 起点为“我的位置”,终点为后台返回的address

NSString *urlString = [[NSString stringWithFormat:@"iosamap://path?sourceApplication=applicationName&sid=BGVIS1&sname=%@&did=BGVIS2&dname=%@&dev=0&t=0",@"我的位置",self.address] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

}else if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"http://maps.apple.com"]]){

// 苹果地图

// 起点为“我的位置”,终点为后台返回的address

NSString *urlString = [[NSString stringWithFormat:@"http://maps.apple.com/?daddr=%@",self.address] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

}else{

// 没有安装上面三种地图APP,弹窗提示安装地图APP

UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"请安地图APP" message:@"建议安装百度地图APP" preferredStyle:UIAlertControllerStyleAlert];

[self presentViewController:alertVC animated:NO completion:nil];

}

}

ios html调起高德地图,iOS 调用百度地图, 高德地图,苹果自带的地图相关推荐

  1. [html] 如何使用H5唤起原生地图APP(百度、高德、腾讯地图等)

    [html] 如何使用H5唤起原生地图APP(百度.高德.腾讯地图等) <iframe src="sinaweibo://qrcode"> 或 <a href=& ...

  2. c语言api获取百度地图,H5调用百度地图API获取地理位置

    //获取当前位置 var geolocation = new BMap.Geolocation(); geolocation.getCurrentPosition(function(r){ alert ...

  3. 【iOS】调用百度、高德地图SDK

    文章目录 调用百度地图SDK 调用高德地图SDK 可能会遇到的问题 调用百度地图SDK 先去百度地图开放平台登陆账号,如果没有注册过需要先注册一个账号.然后进入控制台,选择我的应用,进行创建应用. 其 ...

  4. iOS 高德地图 百度地图 以及苹果自带的地图URI的使用 以及CLLocationManager的使用

    1.CLLocationManager的使用 1.首先Xcode导入一个自己带的官方头文件在任意一个类.h #import<MapKit/MapKit.h> 并遵守两协议 <CLLo ...

  5. 百度高德位置定位服务器,调用百度、高德地图App,百度地图网页版,App定位

    1.首先判断是否安装了目标地图App //判断是否安装目标应用 public static boolean isInstallByread(String packageName) { return n ...

  6. 分享一个关于Java调用百度、高德API、ArcGIS地图获取逆地理的代码

    百度地图和高德地图用户获取国内地址, 区别在于高德地图的精确度比百度地图要高一点, 百度经纬度和高德地图经纬度位置相反, 高德地图不支持国外地址, ArcGIS地图获取国外地址 1.首先需要到高德开发 ...

  7. android 高德地图移动卡顿_Bmap地图,比百度、高德更好用。简洁、无广告。圣诞快乐...

    图片来源网络 首先,首先,首先各位:圣诞节快乐!!! 地图对于现在生活的我们是一款必不可少的手机软件.电子地图简直就是路痴患者的福音. 但是每次一打开百度 地图,高德地图你是不是已经受够了,百度高德漫 ...

  8. Android 地图导航调用百度地图、高德地图、腾讯地图

    效果图 前言 为什么调用第三方呢?集成在App里面不行吗? 接入导航SDK,以百度为例,apk包体积能增加小几十兆之多,上一版本还是几兆的apk,迭代一版本直接几十兆了,落差之大,难以接受. 虽说当下 ...

  9. Android 地图导航调用百度地图、高德地图、腾讯地图,ffmpeg音视频开发实战5

    switch (view.getId()) { - case R.id.tv_navigation: showMapList(); break; } } 2,弹窗 ================== ...

最新文章

  1. 新书 5 折腰斩!畅销技术类图书推荐
  2. python extractall函数_Pandas从str.extractall('#')中给出错误
  3. ubuntu16.04 server unrar解压rar文件提示command not found和解压tar.bz2文件
  4. QT自定义控件之倒计时控件
  5. redis aof和rdb区别
  6. ubuntu 查询cpu个数
  7. Linux 部分(tcp\ip)系统内核优化
  8. js面向对象数据属性和访问器属性,定义多个属性及读取属性的特性
  9. 经验分享:我是如何在网店无货源情况下快速出单?
  10. ie8 升级页面html,ie7浏览器怎么升级到ie8?
  11. Introduction to SAP CPI
  12. java c3p0 jar包_c3p0 jar包下载-c3p0-0.9.1.2.jar包下载 --pc6下载站
  13. 乐橙机器人的价格_乐橙育儿机器人app-大华乐橙机器人app(乐橙宝宝)下载V1.00.001-西西软件下载...
  14. 酞菁-氧化石墨烯(NiPc- NHCO-EGO)|齐岳生物提供酞菁定制材料
  15. 蔡勒(Zeller)公式求星期几模板
  16. iexplore出错
  17. 无人值守系统安装--自己的系统实用篇
  18. 嵌入式linux/鸿蒙开发板(IMX6ULL)开发(二十四)具体单板的GPIO操作方法
  19. 1.4 无穷小与无穷大
  20. CG 学习 (1)——CG概览

热门文章

  1. tf.name_scope与tf.variable_scope用法区别
  2. nginx php 设置时区,laravel5.8(二十)解决时区设置差8个小时解决办法
  3. 安利一个在线图片转ICO格式的网站
  4. 我的第一个安卓应用程序_我如何设计我的第一个应用程序
  5. 用vba复制模板,并根据指定的列形成多个sheet重命名
  6. JavaScript检测原始值、引用值、属性
  7. HMS Core 5,面试必问知识点
  8. 视频原理和FFmpeg
  9. 战双帕弥什qq登录服务器未响应是什么意思,战双帕弥什qq登录
  10. Duplicate Finder for Mac 1.4.3 重复文件查找和删除 破解版下载