首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >-canOpenURL: URL:"comgooglemaps://“失败-错误:”无法完成操作。(OSStatus错误-10814。)“

-canOpenURL: URL:"comgooglemaps://“失败-错误:”无法完成操作。(OSStatus错误-10814。)“
EN

Stack Overflow用户
提问于 2018-09-14 00:41:22
回答 1查看 1.4K关注 0票数 2

我正在使用谷歌地图。我已经知道了纬度和经度。我需要使用坐标在地图上显示位置。但我得到的错误是:

-canOpenURL: URL:"comgooglemaps://“失败-错误:”无法完成操作。(OSStatus错误-10814。)“并将else部分打印为:"Can't use comgooglemaps://“

在info.plist中我添加了: 1. LSApplicationQueriesSchemes Item 0 String googlechromes Item 1 String comgooglemaps

  1. 隐私-使用时的位置使用说明

我的代码如下:

代码语言:javascript
复制
import UIKit
import MapKit

class MapViewController: UIViewController, MKMapViewDelegate {  

  var data7: String?
  var data8: String?

  override func viewDidLoad() {
     super.viewDidLoad()

     getAddress()
    }

  func getAddress() {

    if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) {
      UIApplication.shared.openURL(URL(string:"comgooglemaps://?saddr=&daddr=\(data7),\(data8)&directionsmode=driving")!)
    }
    else {

      print("Can't use comgooglemaps://");
    }
}
EN

回答 1

Stack Overflow用户

发布于 2018-09-14 08:00:40

在安装了谷歌地图应用程序的物理设备(而不是模拟器)上运行您的应用程序,它应该会使用您的代码正确启动。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52318206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档