【发布时间】:2018-07-09 18:03:14
【问题描述】:
SO 上关于 HERE 地图Mobile-SDK 的文档和资源很少,所以我希望有人可以帮助我们。
我们在我们的应用程序中开发了转弯导航(iOSSDKSwift4XCode9)。一切正常,声音下载正确,路线计算正确,定位正确启动,然后我们调用该方法:
private func calculateRoute() {
print("Calculating route")
// Routing mode
let routingMode = NMARoutingMode.init(routingType: NMARoutingType.fastest, transportMode: NMATransportMode.car, routingOptions: NMARoutingOption.avoidBoatFerry)
routeManager.calculateRoute(withStops: [initialCoordinate, destinationCoordinate], routingMode: routingMode) {
(routeResult: NMARouteResult?, error: NMARoutingError?) in
if error == nil || error == NMARoutingError.none {
let mapRoute = routeResult?.routes?.first
self.route = NMAMapRoute.init(mapRoute!)
self.gpsMapView.add(mapObject: self.route!)
self.startNavigation(mapRoute: self.route!)
} else {
os_log("Route calculation completed with errors", log: OSLog.default, type: .debug)
print(error.debugDescription)
}
}
}
private func startNavigation(mapRoute: NMAMapRoute) {
// Start the turn-by-turn navigation
navigationManager.startTurnByTurnNavigation(mapRoute.route)
}
一旦调用了navigationManager里面的start by turn导航方法,最终会调用这个回调:
func navigationManager(_ navigationManager: NMANavigationManager, didUpdateManeuvers currentManeuver: NMAManeuver?, _ nextManeuver: NMAManeuver?) {
nextRoadName.text = nextManeuver?.roadName as String?
displayManeuverImage(icon: currentManeuver?.icon)
}
一旦执行此回调,导航就会完美运行。
我们的问题是调用之间花费的时间:
navigationManager.startTurnByTurnNavigation(mapRoute.route)
而且回调是随机长的。有时是 1 秒(几乎没有),很多时候长达 2 分钟,这对于生产应用程序来说是不可接受的。
在这段等待时间内,我们的代码都没有被执行,所以它一定是 HERE Maps-SDK 的内部问题,或者是我不知道的一些内部问题。
有人知道这里发生了什么吗?
提前致谢!
【问题讨论】:
标签: ios swift xcode9 here-api turn-by-turn