Himanshu Patel Himanshu Patel - 11 months ago 55
Objective-C Question

Clear multipale routes from here map in ios

I'm doing clear HERE MAP like this, but it doesn't work for me:

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];
}


previously i added map route like this.

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];
}

Answer Source

You can't remove map object that you just created. It doesn't matter if the object was created with the same route. You need reference to the previously added NMAMapRoute. I don't see an API on NMAMapView to get the current list of added map objects so you probably have to manage this list yourself.