I am New to ArcGIS. I am Developing an iOS application Using ArcGIS iOS SDK. In that application i want to implement general search of an address like if I type a key word in my search field i want to display all the addresses,blocks,Highways,Avenues etc.. matching to that key word. I write the below code for implementing general search.
ViewController.m
- (void)viewDidLoad { [super viewDidLoad]; self.mapView.layerDelegate = self; self.mapView.callout.delegate = self; self.searchBar.delegate = self; AGSCredential* cred = [[AGSCredential alloc] initWithUser"username" password"password"]; AGSTiledMapServiceLayer *tiledMapServiceLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:[NSURL URLWithString"url"] credential:cred]; [self.mapView addMapLayer:tiledMapServiceLayer]; self.dynamicLayer = [[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString"Dynamic Layer Ursl"] credential:cred]; [self.mapView addMapLayer:self.dynamicLayer withName"POIS"]; [self.mapView addMapLayer:self.dynamicLayer withName"ADDRESSES"]; [self.mapView addMapLayer:self.dynamicLayer withName"HIGHWAYS"]; [self.mapView addMapLayer:self.dynamicLayer withName"AVENUES"]; [self.mapView addMapLayer:self.dynamicLayer withName"ROADS_LANES"]; [self.mapView addMapLayer:self.dynamicLayer withName"BLOCKS"]; [self.mapView addMapLayer:self.dynamicLayer withName"AREAS"]; [self.mapView addMapLayer:self.dynamicLayer withName"GOVERNORATE"]; self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.graphicsLayer withName"Results"]; self.graphicsLayer.calloutDelegate = self; self.findTask = [[AGSFindTask alloc] initWithURL:[NSURL URLWithString"findTaskURL"] credential:cred]; self.findTask.delegate = self; self.findParams = [[AGSFindParameters alloc]init]; } - (void)searchBarSearchButtonClickedUISearchBar *)searchBar { self.mapView.callout.hidden = YES; self.findParams.contains = YES; self.findParams.layerIds = [NSArray arrayWithObjects"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",nil]; self.findParams.outSpatialReference = self.mapView.spatialReference; self.findParams.returnGeometry = TRUE; self.findParams.searchFields = [NSArray arrayWithObjects"SearchFields",nil]; self.findParams.searchText = searchBar.text; [self.findTask executeWithParameters:self.findParams]; [searchBar resignFirstResponder]; } -(void)findTaskAGSFindTask *)findTask operationNSOperation *)op didExecuteWithFindResultsNSArray *)results { [self.graphicsLayer removeAllGraphics]; poiArray = [[NSMutableArray alloc]init]; addressArray = [[NSMutableArray alloc]init]; highwayArray = [[NSMutableArray alloc]init]; avenueArray = [[NSMutableArray alloc]init]; roadLanesArray = [[NSMutableArray alloc]init]; blocksArray = [[NSMutableArray alloc]init]; areasArray = [[NSMutableArray alloc]init]; governarateArray = [[NSMutableArray alloc]init]; poiObjectArray = [[NSMutableArray alloc]init]; addressObjectArray = [[NSMutableArray alloc]init]; highwayObjectArray = [[NSMutableArray alloc]init]; avenueObjectArray = [[NSMutableArray alloc]init]; roadLanesObjectArray = [[NSMutableArray alloc]init]; blocksObjectArray = [[NSMutableArray alloc]init]; areasObjectArray = [[NSMutableArray alloc]init]; governarateObjectArray = [[NSMutableArray alloc]init]; AGSFindResult *result = nil; NSMutableDictionary *d = [[NSMutableDictionary alloc]init]; NSMutableString *d1 = [[NSMutableString alloc]init]; NSMutableString *d2 = [[NSMutableString alloc]init]; NSMutableString *d3 = [[NSMutableString alloc]init]; for (int i=0;i
ViewController.m
- (void)viewDidLoad { [super viewDidLoad]; self.mapView.layerDelegate = self; self.mapView.callout.delegate = self; self.searchBar.delegate = self; AGSCredential* cred = [[AGSCredential alloc] initWithUser"username" password"password"]; AGSTiledMapServiceLayer *tiledMapServiceLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:[NSURL URLWithString"url"] credential:cred]; [self.mapView addMapLayer:tiledMapServiceLayer]; self.dynamicLayer = [[AGSDynamicMapServiceLayer alloc] initWithURL:[NSURL URLWithString"Dynamic Layer Ursl"] credential:cred]; [self.mapView addMapLayer:self.dynamicLayer withName"POIS"]; [self.mapView addMapLayer:self.dynamicLayer withName"ADDRESSES"]; [self.mapView addMapLayer:self.dynamicLayer withName"HIGHWAYS"]; [self.mapView addMapLayer:self.dynamicLayer withName"AVENUES"]; [self.mapView addMapLayer:self.dynamicLayer withName"ROADS_LANES"]; [self.mapView addMapLayer:self.dynamicLayer withName"BLOCKS"]; [self.mapView addMapLayer:self.dynamicLayer withName"AREAS"]; [self.mapView addMapLayer:self.dynamicLayer withName"GOVERNORATE"]; self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.graphicsLayer withName"Results"]; self.graphicsLayer.calloutDelegate = self; self.findTask = [[AGSFindTask alloc] initWithURL:[NSURL URLWithString"findTaskURL"] credential:cred]; self.findTask.delegate = self; self.findParams = [[AGSFindParameters alloc]init]; } - (void)searchBarSearchButtonClickedUISearchBar *)searchBar { self.mapView.callout.hidden = YES; self.findParams.contains = YES; self.findParams.layerIds = [NSArray arrayWithObjects"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",nil]; self.findParams.outSpatialReference = self.mapView.spatialReference; self.findParams.returnGeometry = TRUE; self.findParams.searchFields = [NSArray arrayWithObjects"SearchFields",nil]; self.findParams.searchText = searchBar.text; [self.findTask executeWithParameters:self.findParams]; [searchBar resignFirstResponder]; } -(void)findTaskAGSFindTask *)findTask operationNSOperation *)op didExecuteWithFindResultsNSArray *)results { [self.graphicsLayer removeAllGraphics]; poiArray = [[NSMutableArray alloc]init]; addressArray = [[NSMutableArray alloc]init]; highwayArray = [[NSMutableArray alloc]init]; avenueArray = [[NSMutableArray alloc]init]; roadLanesArray = [[NSMutableArray alloc]init]; blocksArray = [[NSMutableArray alloc]init]; areasArray = [[NSMutableArray alloc]init]; governarateArray = [[NSMutableArray alloc]init]; poiObjectArray = [[NSMutableArray alloc]init]; addressObjectArray = [[NSMutableArray alloc]init]; highwayObjectArray = [[NSMutableArray alloc]init]; avenueObjectArray = [[NSMutableArray alloc]init]; roadLanesObjectArray = [[NSMutableArray alloc]init]; blocksObjectArray = [[NSMutableArray alloc]init]; areasObjectArray = [[NSMutableArray alloc]init]; governarateObjectArray = [[NSMutableArray alloc]init]; AGSFindResult *result = nil; NSMutableDictionary *d = [[NSMutableDictionary alloc]init]; NSMutableString *d1 = [[NSMutableString alloc]init]; NSMutableString *d2 = [[NSMutableString alloc]init]; NSMutableString *d3 = [[NSMutableString alloc]init]; for (int i=0;i