iOS 11 中未显示 MKAnnotationView

MKAnnotationView is not getting displayed in iOS 11

我在 App Store 上有一个应用程序 运行,它具有地图视图和其他功能。

在 iOS 10(除 iOS 11 以外的所有版本)之前一切正常,现在当我在 iOS 11 上测试相同的应用程序时,MKAnnotationView 不是显示(这只发生在 iOS 11)。

没有任何 exception/error 显示。 我想到了 apple 文档,但 API 中没有任何此类弃用,但仍然无法正常工作。

谁能帮我解决这个问题。

我能够通过在 viewForAnnotation 委托方法中的注释视图上调用 "prepareForDisplay" 来显示它。 prepareForDisplay 是 iOS 11 中的新方法,但未记录在案。

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {

    // Current Location Annotation
    if ([annotation isKindOfClass:[MKUserLocation class]]) {
        return nil;
    }

    // Custom Annotation
    if ([annotation isKindOfClass:[CustomAnnotationView class]]) {
        CustomAnnotationView *view = (CustomAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"Custom"];
        if (!view) {
            view = [[CustomAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Custom"];
        } else {
            view.annotation = annotation;
        }

        if (@available(iOS 11.0, *)) {
            [view prepareForDisplay];
        }

        return view;
    }

    return nil;
}

我仍在尝试确定这是错误还是正确使用。敬请期待!