AGSFindTaskDelegate Callback possible to stop in middle.

4364
8
05-08-2015 06:25 AM
GajaNaik
New Contributor III

Hello,

#pragma mark - AGSFindTaskDelegate

-(void)findTask:(AGSFindTask *)findTask operation:(NSOperation *)op didExecuteWithFindResults:(NSArray *)results

is it possible to stop above callback to received data?

if data is very big above delegate called for longer time as long as all data is received, but if user click on back of view or comes out from view ..... app crash on click on GIS VIEW again.

is it possible to stop callback response like after 60 Sec or if user comes out from VIEW ?

Thanks,

0 Kudos
8 Replies
DavidLednik
Occasional Contributor II

Hi Gaja,

QueryTask returns a NSOperation, which you can cancel by calling cancel() method.

NSOperation Class Reference

QueryTask has property named timeoutInterval which by default is set to 60 seconds.

So it should time out if it takes longer than that. But you could make that time shorter.

Let me know if this solves your issue.

regards,

David

0 Kudos
DiveshGoyal
Esri Regular Contributor

When you invoke the FindTask using executeWithParameters:​ , you get back a reference to the NSOperation representing the async operation. You can call cancel​ on the operation to stop it from processing or waiting for the response. 

0 Kudos
GajaNaik
New Contributor III

[op cancel];

have added inside callback but still its been called.....

0 Kudos
DiveshGoyal
Esri Regular Contributor

Inside the callback won't have any affect because by that time the operation is already done.

0 Kudos
GajaNaik
New Contributor III

@property (nonatomic, strong) NSOperation *m_FindOP;

self.m_FindOP = [self.m_findTask executeWithParameters:self.m_findParams];

- (void) btnBack

{

        [self.m_FindOP cancel];

        self.m_FindOP = nil;

}

with above lines of code added, still callback get response...

0 Kudos
GajaNaik
New Contributor III

any further suggestion.....?

0 Kudos
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

This might not related to the "break the call back" code suggestion,

But from an iOS application, it is better to narrow down the find/query result to a more precious and accurate value, which means a less value return that match with the find/query category. If a find result takes more than 60 mins I would suggest to redefine the data attribute or search category.

GajaNaik
New Contributor III

did testing, only for some scenarios it is not possible to narrow down result, depend of address we get results, and we do have 1Min, AlterView so users is freeze to use any other functionality while receiving call back,  but after that if user comes out from controller,  break point does hit on above callback. and if i click on GIS (same controller open)again then it crash... so i was checking out if like in Location Search Stop Location Search functionality is available, which stop further callback, do we have here in any way...

however will try to reduce search if possible.. Thx

0 Kudos