NSMutable数组错误& showAnnotations

时间:2014-03-02 20:18:44

标签: objective-c arrays annotations mutable

我有以下情况。我开发了一个应用程序,经常检索POI的值,我想在地图上显示为注释。为此,我编写了下面的方法,在检索到一组新的POI时调用:

-(void)showAnnotation{

[self removeAllPinsButUserLocation];

annotationArray = [[NSMutableArray alloc] init];

for (Poi *poi in [parser.pois allValues]) {

    myAnnotation *arr = [[myAnnotation alloc] init];
    arr.title = [NSString stringWithFormat:@"%@ (%@)",poi.description, sensor.name];
    arr.subtitle = [NSString stringWithFormat:@"%@, %@ %@",poi.street, poi.postalcode, poi.city];
    arr.coordinate = CLLocationCoordinate2DMake(poi.lattitude, poi.longitude);

    [annotationArray addObject:arr];

    arr = nil;
}

[self.mapView addAnnotations:annotationArray];
[self.mapView showAnnotations:annotationArray animated:NO];

}

问题是我收到错误(由于未捕获的异常'NSGenericException'终止应用程序,原因:' * 集合< __ NSArrayM:0x14ebe9b0>在枚举时发生了变异。')

但是,只有我设置了动画:最后一行没有,但设置为动画时没有:是...

有人对此有答案吗?

感谢您的回复!

Eelco

0 个答案:

没有答案