设置手势委托时无法 select 地图对象

Unable to select a map object when Gesture delegate set

这是一个与 HERE iOS HybridPlus SDK 相关的问题。

如果与 class NMAMapViewNMAMapViewDelegateNMAMapGestureDelegate 的 mapView 进行了任何交互,则只有 NMAMapGestureDelegate 的方法被调用.

例如:

如果点击地图上的对象,则会调用 - mapView:didReceiveTapAtLocation: 而不会调用 - mapView:didSelectObjects:

而在 android 中情况并非如此。在 android 中,如果一个对象被点击并且两个委托都被设置,那么上面提到的两个方法都会被调用。

问题:iOS中的解决方法是什么?

HERE 开发支持 得到了这个答案。

The mapView:didSelectObjects: is not getting called, because they are overriding the default tap handler by implementing mapView:didReceiveTapAtLocation in their NMAMapGestureDelegate. Because this is a protocol, they cannot call mapView:didReceiveTapAtLocation of the super class to run the default implementation, after they perform operation they need. However objects passed to mapView:didSelectObjects: are retrieved in a standard way, which is available to the customer, therefore they can mimic the default implementation, for example:

- (void)mapView:(NMAMapView *)mapView didReceiveTapAtLocation:(CGPoint)location  {

    NSLog(@"didReceiveTapAtLocation: %fx%f", location.x, location.y); 
    if ([mapView.delegate respondsToSelector:@selector(mapView:didSelectObjects:)]) { 
        // Check to see if any objects are selected 
        NSArray *selectedObjects = [mapView visibleObjectsAtPoint:location]; 
        // If any objects were selected, treat the tap as a selection 
        if (selectedObjects.count > 0) { 
            [mapView.delegate mapView:mapView didSelectObjects:selectedObjects]; 
        } 
    } 
}