HERE Maps SDK iOS Swift 4 turn by turn 导航启动时间过长

HERE Maps SDK iOS Swift 4 turn by turn navigation takes too long to start

SO 上关于 HERE 地图 Mobile-SDK 的可用文档和资源很少,所以我希望有人能帮助我们。

我们在应用程序中开发了转弯导航 (iOS SDK Swift4 XCode9)。一切正常,语音下载正确,路线计算正确,定位正确启动,然后我们调用方法:

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 中的开始导航方法,最终将调用此回调:

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 分钟,这对于生产应用程序来说是不可接受的。

我们的代码

None 正在这段等待时间内执行,因此它一定是 HERE Maps-SDK 的内部问题,或者是我不知道的一些内部问题。

有人知道这里发生了什么吗?

提前致谢!

发生这种情况是因为只有在用户开始移动时才会发送下一个动作。当用户静止时,引擎无法找出哪个方向,位置的准确性。一旦检测到足够的移动,就会触发机动。

您应该显示引擎在计算路线后的初始机动。也许如果用户没有移动,您可以展示旧策略的祝酒词来推动用户移动。