While plotting the values on Arcgis, Arcgis is throwing below exception:
libc++abi.dylib: terminating with uncaught exception of type Esri_runtimecore::Common::Out_of_range_exception: Out of range
I am trying to plot the coordinates as polygon on the map.
Here is my code snippet
AGSGeometryEngine* engine = [AGSGeometryEngine defaultGeometryEngine];
AGSSpatialReference *specailRefference = [AGSSpatialReference spatialReferenceWithWKID:3857];
AGSMutablePolygon *polyGon = [[AGSMutablePolygon alloc] initWithSpatialReference:specailRefference];
AGSPoint *minGPSPoint = [[AGSPoint alloc] initWithX:minLon
y:minLat
spatialReference:[AGSSpatialReference wgs84SpatialReference]];
AGSPoint *minMapPoint = (AGSPoint*) [engine projectGeometry:minGPSPoint
toSpatialReference:specailRefference];
[polyGon addPointToRing:minMapPoint];
AGSPoint *maxGpsPoint = [[AGSPoint alloc] initWithX:maxLon
y:maxLat
spatialReference:[AGSSpatialReference wgs84SpatialReference]];
AGSPoint *maxMapPoint = (AGSPoint*) [engine projectGeometry:maxGpsPoint
toSpatialReference:specailRefference];
[polyGon addPointToRing:maxMapPoint];
AGSSketchGraphicsLayer *gpsSketchLayer = [[AGSSketchGraphicsLayer alloc] initWithGeometry:nil];
[self.mapView addMapLayer:gpsSketchLayer withName:@"Sketch layer"];
AGSGraphic *graphic=[[AGSGraphic alloc]initWithGeometry:polyGon symbol:[self barrierSymbol2] attributes:nil];
[gpsSketchLayer addGraphic:graphic];
App is crashing is on [polyGon addPointToRing:minMapPoint]
this line.
I have searched around for this issue and I found out that in case of invalid coordinates we get this error.
If we face this issue we need to check the input parameters.