代码如下:
[_mapview removeAnnotations:_mapview.annotations];
运行崩溃,错误信息如下:
BaiduMapSW[7782:707] *** Terminating app due to uncaught exception 'NSGenericException', reason:
'*** Collection <__NSArrayM: 0x2c1690> was mutated while being enumerated.'
*** First throw call stack:
解决方法:
NSArray* array = [NSArray arrayWithArray:_mapView.annotations];
[_mapView removeAnnotations:array];