我试图在我的Swift应用程序(iOS 8+目标)中显示A点和B点之间的所有可能路线.我允许用户选择我的应用程序中的任何一个可能的路线.接下来,我希望用户能够使用在Apple Maps应用程序中导航所选路线(MKRoute)
var fullRouteResponse:MKDirectionsResponse? //This variable has MKRoute information
@IBAction func openInAppleMaps(sender: AnyObject)
{
let placemark = MKPlacemark(coordinate: destinationCoordinate!, addressDictionary: nil)
mapItem = MKMapItem(placemark: placemark)
mapItem.openInMapsWithLaunchOptions(
[MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsMapTypeKey: MKMapType.Standard.rawValue,
MKLaunchOptionsShowsTrafficKey: true ])
}
Run Code Online (Sandbox Code Playgroud)
这会打开地图应用程序,但我无法弄清楚如何传递特定选定的MKRoute信息,以便用户无需从Apple地图应用程序中的所有可能路线重新选择.
我不确定这是否可能,所以任何指针都会有所帮助.谢谢!