我目前正在开发一个转弯导航应用程序,我使用API Skobbler,我设法集成,但是当我进行实时测试时,我注意到我没有从回调中获取信息,例如:
-(void)routingService:(SKRoutingService *)routingService didUpdateFilteredAudioAdvices:(NSArray *)audioAdvices{
NSLog(@"audio advices: %@",audioAdvices);
} - (void)routingService:(SKRoutingService *)routingService didChangeCurrentStreetName:(NSString *)currentStreetName streetType:(SKStreetType)streetType countryCode:(NSString *)countryCode {
NSLog(@"street name: %@,%d,%@",currentStreetName,streetType,countryCode );
// NSLog(@"routing service array: %@",routingService.visualAdviceConfigurations);
} - (void)routingService:(SKRoutingService *)routingService didChangeCurrentAdviceImage:(UIImage *)adviceImage withLastAdvice:(BOOL)isLastAdvice {
NSLog(@"image changed");
}
- (void)routingService:(SKRoutingService *)routingService didChangeCurrentAdviceInstruction:(NSString *)currentAdviceInstruction nextAdviceInstruction:(NSString *)nextAdviceInstruction{
NSLog(@"current instruction: %@",currentAdviceInstruction);
}
我得到的唯一回调是:
(void)routingService:(SKRoutingService *)routingService didChangeCurrentSpeed :( double)speed {
NSLog(@“速度:%f”,速度);
} - (void)routingService:(SKRoutingService *)routingService didChangeDistanceToDestination:(int)distance withFormattedDistance:(NSString *)formattedDistance {
NSLog(@"distance: %@",formattedDistance);
}
感谢您的帮助。
答案 0 :(得分:1)
- (void)routingService:(SKRoutingService *)routingService didFinishRouteCalculationWithInfo:(SKRouteInformation*)routeInformation{
NSLog(@"Route is calculated.");
[routingService zoomToRouteWithInsets:UIEdgeInsetsZero]; // zooming to currrent route
//NSArray *adviceList = [routingService routeAdviceListWithDistanceFormat:SKDistanceFormatMetric]; // array of SKRouteAdvice
NSLog(@"routing distance : %d",routeInformation.distance);
NSLog(@"routing time : %d",routeInformation.estimatedTime);
SKNavigationSettings* navSettings = [SKNavigationSettings navigationSettings];
navSettings.navigationType=SKNavigationTypeReal;
navSettings.distanceFormat=SKDistanceFormatMetric;
[SKRoutingService sharedInstance].mapView.settings.displayMode = SKMapDisplayMode3D;
[[SKRoutingService sharedInstance]startNavigationWithSettings:navSettings];
}
这就是我开始导航的方式: