在我的地图视图中添加叠加层时,我收到以下警告:
Sending 'MKOverlayView *const __strong' to parameter of incompatible type 'id<MKOverlay>'
该代码运行良好,并且覆盖层按应有的方式绘制,但我很想摆脱警告。导致它的代码:
for(MKOverlayView *overlay in [mapView overlays]) {
[mapView removeOverlay:overlay];
}
(显然,for 循环内的行是引发此错误的原因)Google 没有针对该错误的单一结果。仅与 MKAnnotationView 类似。那里的解决方案(例如):
for(id<MKOverlay> *overlay in [mapView overlays]) {
[mapView removeOverlay:overlay];
}
引发错误。
有任何想法吗?谢谢!