计算后 SKRoutingService 不缩放到路由

SKRoutingService not zooming to route after calculated

SKRoutingService 计算后不缩放到路由是否存在已知错误?

接下来是我的案例场景:我在一个视图控制器中有一个场地列表。 当用户点击它们中的任何一个时,另一个 ViewController 将打开并在它们上面,将使用以下代码创建 SKMapView 的新实例:

-(void)initMap
{
_map = [[SKMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _mapView.frame.size.height)];

//UIView* userInteractionBlocker = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, _mapView.frame.size.height)];
//[_mapView addSubview:userInteractionBlocker];

_map.settings.rotationEnabled = YES;
_map.settings.displayMode = SKMapDisplayMode2D;

_map.mapScaleView.hidden = YES;
//[map centerOnCurrentPosition];
//[map animateToZoomLevel:25.0];

[SKRoutingService sharedInstance].mapView = _map;
[SKRoutingService sharedInstance].routingDelegate = self;

SKRouteSettings* route = [[SKRouteSettings alloc]init];

route.startCoordinate=CLLocationCoordinate2DMake([Constants shared].selectedExit.lat, [Constants shared].selectedExit.lon);
route.destinationCoordinate=CLLocationCoordinate2DMake([Constants shared].selectedVenue.lat, [Constants shared].selectedVenue.lon);

UIImage *venuePin;
switch (_venue.primary_category) {
    case 626:
        venuePin = [UIImage imageNamed:@"pinGasBlack"];
        break;
    case 623:
        venuePin = [UIImage imageNamed:@"pinHotelBlack"];
        break;
    case 593:
        venuePin = [UIImage imageNamed:@"pinFoodYellow"];
        break;
}
SKAnnotation* exit = [self createPinWithImage:[UIImage imageNamed:@"pinExitYellow"] atCoordinates:CLLocationCoordinate2DMake([Constants shared].selectedExit.lat, [Constants shared].selectedExit.lon) withIdentifier:@"pinExit" identifier:0];
SKAnnotation* venue = [self createPinWithImage:venuePin atCoordinates:CLLocationCoordinate2DMake([Constants shared].selectedVenue.lat, [Constants shared].selectedVenue.lon) withIdentifier:@"pinVenue" identifier:1];

[_map addAnnotation:exit withAnimationSettings:nil];
[_map addAnnotation:venue withAnimationSettings:nil];

[_mapView addSubview:_map];

[[SKRoutingService sharedInstance] calculateRoute:route];
}

- (void)routingService:(SKRoutingService *)routingService didFinishRouteCalculationWithInfo:(SKRouteInformation*)routeInformation{
[[SKRoutingService sharedInstance] zoomToRouteWithInsets:UIEdgeInsetsZero];

}

事情是,我第一次打开场地屏幕时,路线被计算并完美缩放。

但是一旦我返回,select 另一个地点并到达 ViewController 应该初始化另一张新地图并缩放到路线位置的地方,它就不会发生。 发生的事情是: - 地图已初始化 - 计算路线 - 地图注释位置完美

但它被缩小到显示地球...如此完全缩小,即使我设置

[[SKRoutingService sharedInstance] zoomToRouteWithInsets:UIEdgeInsetsZero];

而且我查了下,路由计算后代码是可达的,只是就是不缩放?

有什么解决办法吗?

这是一个错误:调用 zoomToRouteWithInsets 两次

详情见Skobbler map not zooming with zoomToRouteWithInsets