【发布时间】:2015-09-05 00:33:37
【问题描述】:
我正在尝试在我的 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 ])
}
这很好地打开了地图应用程序,但我无法弄清楚如何传递特定的选定 MKRoute 信息,以便用户不必从 Apple 地图应用程序中的所有可能路线中重新选择。
我不确定这是否可能,所以任何指针都会有帮助。谢谢!
【问题讨论】:
-
类似:question
-
@Raptor 仍然没有得到答复 :( 我能够打开地图应用程序并前往目的地(地图应用程序询问我选择哪条路线)。它没有考虑到我已经在我的应用中选择了特定路线。我无法将该信息传递给地图应用。
-
你解决了吗?
-
不,还没弄明白
标签: ios swift ios8 mapkit apple-maps