MapKit does not delete all annotations

MapKit seems to have a weird problem !!!

I have a code that adds some annotations and then I call

NSArray *existingpoints = mapView.annotations;
[mapView removeAnnotations:existingpoints];
                if ([mapView.annotations count] > 0) {
                    for(Plane *annotation in mapView.annotations){
                        NSLog(@"Name: %@",annotation.reg);
                        [mapView removeAnnotation:annotation];
                    }
                    NSLog(@"\nMapCount:%i after attempting manual remove",[mapView.annotations count]);
                }

Now the weird bit is that from time to time I can get a counter greater than 0 inside mapView.annotations. Therefore, therefore, I have additional โ€œprotectionโ€ and try manually deleting the item, rather than getting NSLogged.

However, the final score is 1 more after that!

The strangest thing!

+3
source share
1 answer

I recorded an error with Apple ....

They acknowledge that this is a problem with 4.2

+2
source

Source: https://habr.com/ru/post/1775970/


All Articles