diff --git a/mapbox.ios.js b/mapbox.ios.js index 31bf9e4..7b5e6fa 100755 --- a/mapbox.ios.js +++ b/mapbox.ios.js @@ -218,6 +218,12 @@ mapbox.removeMarkers = function (ids, nativeMap) { markersToRemove.push(marker.ios); } } + + // remove markers from cache + mapbox._markers = mapbox._markers.filter(function (marker) { + return ids.indexOf(marker.id) < 0; + }) + if (markersToRemove.length > 0) { theMap.removeAnnotations(markersToRemove); } @@ -873,4 +879,4 @@ var MGLMapViewDelegateImpl = (function (_super) { return MGLMapViewDelegateImpl; })(NSObject); -module.exports = mapbox; \ No newline at end of file +module.exports = mapbox;