Can't render polygon (can't reserve indicies: XX): featureID: X key: XXXX

本小妞迷上赌 提交于 2019-12-22 05:20:06

问题


I have use Mac OS X 10.9.3 and Xcode 5.1.1

In my app I have to use MKMapView, It's all are working fine but in iOS 6.1, I have stranger error display in console, such like,

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)

Like as a This question.

I want to know about this error and why this is displaying in iOS 6.1 and how can I solve it?

My code is:

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:


I also had the same output in my console on iOS 6.1.

In my case the problem was that I tried to zoom out the map based on a coordinate which was (0.00000,0.00000), and it created strange rendering problems only in the first time that I opened the map. after I re-opened the map it worked correctly. But when the coordinate wasn't (0.00000,0.00000), it always worked.

Maybe you should check that the value of theCoordinate is what you want it to be.



来源:https://stackoverflow.com/questions/23966911/cant-render-polygon-cant-reserve-indicies-xx-featureid-x-key-xxxx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!