嗨,我有功能更新的代码,我在其中传递了一个地址,以通过坐标从服务器提取地址。但是,当这打开Apple Maps时,方向将向后。有谁知道如何解决这一问题?
我试图更改我的参数以及地址的提取方式,但是没有运气。
func openAppleMaps(location : CLLocationCoordinate2D){
let appleMapsURL = URL(string: "http://maps.apple.com");
if (UIApplication.shared.canOpenURL(appleMapsURL!)) {
var directionRequestURL = appleMapsURL!.relativeString
let param1 = "?daddr=" + "\(location.latitude)" + "," + "\(location.longitude)"
let param2 = "&saddr=" + "\(LocationManager.shared.locationManager.location!.coordinate.latitude)" + "," + "\(LocationManager.shared.locationManager.location!.coordinate.longitude)" + "&dirflg=d"
directionRequestURL += param1 + param2
UIApplication.shared.open(URL(string: directionRequestURL)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil);
}
}
我需要显示当前位置和要显示的地址。不后退。谢谢