Solved! Go to Solution.
-(void) mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics{ NSURL *petroURL=[[NSURL alloc]initWithString:@"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"]; //AGSIdentifyTask *task=[AGSIdentifyTask identifyTaskWithURL:petroURL]; AGSIdentifyTask *task=[[AGSIdentifyTask alloc]initWithURL:petroURL]; [task setDelegate:self]; AGSIdentifyParameters *param=[[AGSIdentifyParameters alloc]init]; param.layerIds=[NSArray arrayWithObjects:[NSNumber numberWithInt:5], nil]; param.tolerance=5; param.geometry=mappoint; param.size=self.mapView.bounds.size; AGSEnvelope *env=[[AGSEnvelope alloc]initWithXmin:-10948000 ymin:-6624000 xmax:9794000 ymax:7406000 spatialReference:self.mapView.spatialReference]; param.mapEnvelope=env; param.returnGeometry=YES; param.layerOption=AGSIdentifyParametersLayerOptionAll; param.spatialReference=self.mapView.spatialReference; [task executeWithParameters:param]; } -(void) identifyTask:(AGSIdentifyTask *)identifyTask operation:(NSOperation *)op didExecuteWithIdentifyResults:(NSArray *)results{ NSLog(@" %@ ",[results count]); }
It's not getting any result because AGSIdentifyTask is getting released. Create a retain property for "AGSIdentifyTask *task" and then try.
Regards,
Nimesh
[task retain]
If you are using ARC then you should create property with 'strong' keyword.
in .h file
@property (nonatomic, strong) AGSIdentifyTask *task;
in .m file
@synthesize task;
self.task=[[AGSIdentifyTask alloc]initWithURL:petroURL];
Regards,
Nimesh