无法呈现多边形(无法保留索引:XX):featureID:X key:XXXX。

6

我使用的是 Mac OS X 10.9.3Xcode 5.1.1

我的应用程序需要使用 MKMapView,在 iOS 6.1 中一切都正常工作,但在控制台中显示了奇怪的错误,例如:

Can't render polygon (can't reserve indicies: 1482): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 570): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 30): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 390): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 330): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 18): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 30): featureID: 0 key: 0.0.1 (512)
Can't render polygon (can't reserve indicies: 18): featureID: 0 key: 0.0.1 (512)

就像这个问题一样。

我想了解这个错误为什么会在iOS 6.1中显示,以及如何解决它?

我的代码是:

self.mapView = [[MKMapView alloc] init];
self.mapView.frame = CGRectMake(30, 30, 140, 105);
[self.mapView setMapType:MKMapTypeStandard];
[self.mapView setZoomEnabled:YES];
[self.mapView setScrollEnabled:YES];
[self.mapView setDelegate:self];
self.mapView.layer.borderWidth = 1;
self.mapView.layer.borderColor = [UIColor lightGrayColor].CGColor;
[self.scrollView addSubview:self.mapView];
self.pointAnnotation = [[MKPointAnnotation alloc] init];
[self setMAPAnnotationAndCallout]; /// custom method for set annotation pin and callout

-(void)setMAPAnnotationAndCallout
{
    CLLocationCoordinate2D theCoordinate ;
    theCoordinate.latitude = [[self.dicOfMAP objectForKey:@"latitude"] doubleValue];
    theCoordinate.longitude = [[self.dicOfMAP objectForKey:@"longitude"] doubleValue];

    self.pointAnnotation.coordinate = theCoordinate;
    self.pointAnnotation.title = @"Title";
    self.pointAnnotation.subtitle = @"SubTitle";
    int region = 8000;
    MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:MKCoordinateRegionMakeWithDistance(theCoordinate, region, region)];
    [self.mapView setRegion:adjustedRegion animated:YES];
}

#pragma mark -
#pragma mark - MKMapView Delegate Methods

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
    MKAnnotationView *aV;
    for (aV in views)
    {
        CGRect endFrame = aV.frame;
        aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y - 230.0, aV.frame.size.width, aV.frame.size.height);
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.70];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
        [aV setFrame:endFrame];
        [UIView commitAnimations];
    }
}

- (MKAnnotationView *)mapView:(MKMapView *)sender viewForAnnotation:(id < MKAnnotation >)annotation
{
    static NSString *reuseId = @"StandardPin";
    MKPinAnnotationView *aView = (MKPinAnnotationView *)[sender dequeueReusableAnnotationViewWithIdentifier:reuseId];
    if (aView == nil)
    {
        aView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseId];
        aView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        aView.canShowCallout = YES;
    }
    aView.annotation = annotation;

    return aView;
}

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    [mapView deselectAnnotation:view.annotation animated:YES];
}
1个回答

5
我在iOS 6.1中的控制台中也有同样的输出。
我的情况是,我尝试基于一个坐标(0.00000,0.00000)放大地图,这会在我第一次打开地图时创建奇怪的渲染问题。当我重新打开地图后,它就可以正常工作了。但是,当坐标不是(0.00000,0.00000)时,它总是有效的。
也许你应该检查theCoordinate的值是否符合你的要求。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接