Reputation: 21
I am using Here Maps's Premium SDK for iOS, on Xcode 8.2, Swift 3. Currently, I could display the maps, find my current location, and center the map to my current location.
However, when I am trying to calculate the route using NMACoreRouter, it always return error. The following are parts of my codes:
private var nma_core_router: NMACoreRouter!
...
nam_core_router = NMACoreRouter.init()
...
let geo1 = NMAGeoCoordinates(latitude: lat1, longitude: lng1)
let geo2 = NMAGeoCoordinates(latitude: lat2, longitude: lng2)
let pt1 = NMAWaypoint(geoCoordinates: geo1!)
let pt2 = NMAWaypoint(geoCoordinates: geo2!, waypointType: NMAWaypointType.stopWaypoint)
let stops = [pt1!, pt2!]
let mode = NMARoutingMode(routingType: NMARoutingType.shortest, transportMode: NMATransportMode.bike, routingOptions: 0)
nma_core_router.calculateRoute(withStops: stops, routingMode: mode!) {
(routeResult: NMARouteResult?, error: NMARoutingError?) in
if error == nil {
// handle routing results
} else {
//====> always here, no matter how accurate the coordinates were
}
}
The error always appear and has NMARoutingError
could someone tell me what did I do wrong?
Upvotes: 0
Views: 582
Reputation: 2190
Due to: https://developer.here.com/mobile-sdks/documentation/ios-hybrid-plus/topics_api_nlp_hybrid_plus/group--nma--route.html#topic-apiref__nmaroutingtype the routingtype "shortest" is only supported for cars. Since you try to calculate a bike route, please use routingtype "fastest" instead.
Upvotes: 1