Search code examples
iosskmaps

Need a delegate that returns me the next advice in textual form


I am looking for a delegate method that gets triggered when there's a new advice (like "turn left now") and that returns me that advice in a textual form. I found the didChangeAdviceID delegate method in the SKNavigationDelegate but when I test it with;

navSettings.navigationType = SKNavigationTypeSimulation;

it gets triggered one time with advice changed: -1 and that's it.

Also when I try to get the collection of all calculated advices with:

NSArray *adviceList = [[SKRoutingService sharedInstance] routeAdviceListWithDistanceFormat:SKDistanceFormatMetric];
for (SKRouteAdvice *advice in adviceList) {
    NSLog(@"%d: %@", [advice adviceID], [advice adviceInstruction]);
}

so that I can get the current advice by calling the index I don't get anything in the adviceInstruction property. It's simply empty. The id however is displayed properly (there's like 20 entries for my testing route).


Solution

  • In the demo app there is a demo of navigating a route with navigationType simulation (see the Routing & Navigation demo) and there you can have a look at all the callbacks being called during navigation.

    Right now in the callbacks you won't get the current/next advice in text form but only in visual form (as a openGL generated picture) and audio form (as a audio advice). In a future update (could be June) of the SDK there will also be text advices, something like:

    void)routingService:(SKRoutingService *)routingService didChangeCurrentAdviceInstruction:(NSString *)currentAdviceInstruction nextAdviceInstruction:(NSString *)nextAdviceInstruction; 
    

    For the current version a list of routing directions can be retrieved once a route is calculated (e.g. http://developer.skobbler.com/getting-started/ios#sec15) and there you can see “adviceInstructions” in the form of a string.

    Though, during actual navigation, more info than just the one found in the routing directions will be presented to the user.