how to create a findtaskparameters

07-17-2010 04:14 AM
New Contributor
self.findParameters = [[AGSFindParameters alloc] init];

self.findParameters.contains = YES;
self.findParameters.layerIds = [NSArray arrayWithObjects:[NSNumber numberWithInt:8],nil];
self.findParameters.searchFields = [NSArray arrayWithObjects:@"OWNER_NAME",nil];
self.findParameters.searchText = @"cline";
self.findParameters.returnGeometry = YES;
self.findParameters.outSpatialReference = self.mapView.spatialReference;

I create it like this, but it can't work.
the findtask is below:
self.findTask = [AGSFindTask findTaskWithURL:[NSURL]];

it can't not execute the delegate protocol
Is there any problem?
0 Kudos
3 Replies
New Contributor III
I'm also having a problem with the findTaskDelegate not being triggered, I've got the view controller set to be the delegate.

Setting up the findTask:

[[self.findTask alloc] initWithURL:self.dynamicLayersURL];
self.findTask.delegate = self;

Executing it:

- (void)searchBarSearchButtonClicked:(UISearchBar *)theSearchBar

// Get find parameters
AGSFindParameters *findParam = [[AGSFindParameters alloc] init];
findParam.contains = YES;
findParam.layerIds = findLyrIds;
findParam.returnGeometry = NO;
findParam.searchFields = findFields;
findParam.searchText = theSearchBar.text;

// Execute the find task
[self.findTask executeWithParameters:findParam];

It never sets off didExecuteWithFindResults or didFailWithError, Any ideas?
0 Kudos
New Contributor III
Sorry, have answered my own question! I should have initialised the FindTask like this:
self.findTask = [[AGSFindTask alloc] initWithURL:self.dynamicLayersURL];

Hope this helps Bleum.
0 Kudos
New Contributor

self.findTask = [AGSFindTask findTaskWithURL:[NSURL]];

self.findTask is a retain property right? Otherwise, this won't work.
Also, don't forget to set the delegate:
self.findTask.delegate = self;

The object must implement the AGSFindTaskDelegate protocol.
0 Kudos