GMSMapView(谷歌地图)GMSGeometryContainesLocation方法在iOS中崩溃了?

GMSMapView(谷歌地图)GMSGeometryContainesLocation方法在iOS中崩溃了?,ios,objective-c,google-maps,coordinates,Ios,Objective C,Google Maps,Coordinates,我在GMSMapView iOS(谷歌地图)中使用这个gmsGeometryContainesLocation()方法 当我检查当前坐标是否在GMSPolygon下时,它将崩溃 if (GMSGeometryContainsLocation(userLocation.coordinate, self.path, YES)) { NSLog(@"YES: you are in this polygon."); } else { NSLog(@"You

我在GMSMapView iOS(谷歌地图)中使用这个gmsGeometryContainesLocation()方法

当我检查当前坐标是否在GMSPolygon下时,它将崩溃

 if (GMSGeometryContainsLocation(userLocation.coordinate, self.path, YES)) {

        NSLog(@"YES: you are in this polygon.");

    } else {

        NSLog(@"You do not appear to be in this polygon.");

    }
由于EXC\u访问错误而崩溃。请帮忙

这就是我向路径添加坐标的方式,我可以看到地图中的所有多边形

 for(int i = 0; i < [[polygon  valueForKey:@"polygon_coordinates"] count]; i++){

                    [self.path addCoordinate:CLLocationCoordinate2DMake([[[[polygon  valueForKey:@"polygon_coordinates"] objectAtIndex:i] objectAtIndex:1] floatValue],[[[[polygon  valueForKey:@"polygon_coordinates"] objectAtIndex:i] objectAtIndex:0] floatValue])];
                }



            GMSPolygon *rectangle = [GMSPolygon polygonWithPath:self.path];
            rectangle.fillColor = [UIColor colorWithRed:255.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.4];
            rectangle.title = RESTRICTED_AREA_PICKUP;
            rectangle.map = self.mapView;
for(int i=0;i<[[polygon valueForKey:@“polygon_坐标”]计数];i++){
[self.path addCoordination:CLLocationCoordinate2DMake([[[[polygon valueForKey:@“polygon_坐标”]objectAtIndex:i]objectAtIndex:1]floatValue],[[polygon valueForKey:@“polygon_坐标”]objectAtIndex:0]floatValue]);
}
GMSPolygon*rectangle=[GMSPolygon polygon-withpath:self.path];
rectangle.fillColor=[uicolorWithred:255.0/255.0绿色:0.0/255.0蓝色:0.0/255.0 alpha:0.4];
rectangle.title=限制区域拾取;
rectangle.map=self.mapView;

崩溃的原因是,GMSMutablePath。我使用的是GMSMutablePath而不是GMSPath

 if (GMSGeometryContainsLocation(userLocation.coordinate,(GMSPath *)self.path, NO)) {

        NSLog(@"YES: you are in this polygon.");
    } else {
        NSLog(@"You do not appear to be in this polygon.");

    }

崩溃背后的原因是,GMS路径。我使用的是GMSMutablePath而不是GMSPath

 if (GMSGeometryContainsLocation(userLocation.coordinate,(GMSPath *)self.path, NO)) {

        NSLog(@"YES: you are in this polygon.");
    } else {
        NSLog(@"You do not appear to be in this polygon.");

    }

你能和我分享一下这节课的其他内容吗?也许userLocation.coordinate或self.path都是nil?它们都有值,我已经检查过,如果没有更多的附带代码,很难进一步调试。你能分享这个类的其余部分吗?也许userLocation.coordinate或self.path都是nil?它们都有值,我已经检查过了,如果没有更多的附带代码,很难进一步调试。