从此处地图清除 ios 中的多条路线

Clear multipale routes from here map in ios

我正在像这样清除 HERE MAP,但它对我不起作用:

for (int i=0; i<self.NewMapRoute.count; i++)
{
     self.route = self.NewMapRoute[i];

     self.mapRoute = [NMAMapRoute mapRouteWithRoute:self.route];
     [self.mapView removeMapObject:self.mapRoute];
}

之前我是这样添加地图路线的

for (int i=0; i<self.NewMapRoute.count; i++)
{
      self.route = self.NewMapRoute[i];

      self.mapRoute = [NMAMapRoute mapRouteWithRoute:self.route];
      [self.mapRoute setColor:[arrycolor objectAtIndex:i]];
      [self.mapView addMapObject:self.mapRoute];
}

您不能删除刚刚创建的地图对象。对象是否使用相同的 route 创建并不重要。您需要参考之前添加的NMAMapRoute。我在 NMAMapView 上没有看到 API 以获取当前添加的地图对象列表,因此您可能必须自己管理此列表。