Iphone MapKit未删除所有注释
MapKit似乎有一个奇怪的问题 我有一些添加注释的代码,然后调用Iphone MapKit未删除所有注释,iphone,mapkit,mkmapview,mkannotation,mkannotationview,Iphone,Mapkit,Mkmapview,Mkannotation,Mkannotationview,MapKit似乎有一个奇怪的问题 我有一些添加注释的代码,然后调用 NSArray *existingpoints = mapView.annotations; [mapView removeAnnotations:existingpoints]; if ([mapView.annotations count] > 0) { for(Plane *annotation in mapView.annotations){
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]);
}
现在奇怪的是,有时我可以进入mapView。注释计数大于0。因此,我有额外的“保护”,并尝试手动删除该项目,然后注销
然而,在所有这些之后,最终计数仍然是1
真奇怪 已经记录了苹果的一个bug
他们承认这是4.2中的一个问题,不确定这是否会导致此问题,但您是否已打开showsUserLocation?不,不在本例中,我没有。我做到了,那是我的第一个停靠港!在调试器中检查其余注释时会发生什么情况?看看剩下的对象及其内容。奇怪的是,它是一个有效对象,具有所有属性。它甚至显示在地图上,我可以与它互动!你是否知道它是什么时候修复的(即从哪个iOS版本修复的),或者它是否仍然是一个bug?老实说,我完全重写了它周围的代码,现在已经修复了。感谢您的反馈:)