【发布时间】:2019-02-18 10:54:18
【问题描述】:
我正在使用谷歌地图。我已经给出了纬度和经度。我需要使用坐标在地图上显示位置。但我得到错误:
-canOpenURL:URL 失败:“comgooglemaps://” - 错误:“操作无法完成。(OSStatus 错误 -10814。)” 并将 else 部分打印为:“Can't use comgooglemaps://”
在 info.plist 我添加了: 1. LSApplicationQueriesSchemes 项目 0 字符串 googlechromes 项目 1 字符串 comgooglemaps
- 隐私 - 使用时的位置使用说明
我的代码已给出:
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://");
}
}
【问题讨论】:
-
为什么要投反对票?我没有得到搜索的解决方案?
标签: google-maps mapkit swift4