我不知道为什么xcode会显示此消息,请查看我的代码:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
if (annotation==self.mapView.userLocation) {
return nil;
NSString *pinID = @"Salvar";
MKPinAnnotationView *view = (MKPinAnnotationView*)
[self.mapView dequeueReusableAnnotationViewWithIdentifier:pinID];
if (view==nil) {
view = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:pinID];
view.canShowCallout = YES;
view.animatesDrop = YES;
}
return view;
}
}
答案 0 :(得分:1)
annotation!=self.mapView.userLocation
。
要修复,请在第一个条件中添加一个else块,或者在最终关闭卷曲之前无条件地返回一些内容。
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
if (annotation==self.mapView.userLocation) {
// the code that you have already here
} else {
return nil; // or whatever you would return if annotation!= userLocation
}
// or, instead of the else above...
return nil;
}