AGSQueryTaskDelegate not firing

1896
2
Jump to solution
12-05-2013 10:26 PM
NicoleDe_La_Feld
New Contributor II
I am trying to query all the features from my database through a querytask, but no delegate methods are being invoked.
I created a strong property AGSQueryTask :
@interface MyClass : NSObject <AGSQueryTaskDelegate> 

@property(nonatomic, strong)AGSQueryTask* queryTask;

set the delegate as self:
 self.queryTask.delegate = self;

but nothing happens.
Ideas?
0 Kudos
1 Solution

Accepted Solutions
NicoleDe_La_Feld
New Contributor II
Thank you for your answer. I already did what you say and it's right.
The problem was that I accidentally deallocated the queryTask before the operation was completed.

View solution in original post

0 Kudos
2 Replies
ChristopherBarger
New Contributor
sorry if i'm misunderstand your question but you'll need to set up a query to excecute your query task. Here is a simplified example.


//alongside your agsquerytask set up an agsquery
@property(nonatomic, strong)AGSQueryTask* queryTask;
@property(nonatomic, strong)AGSQuery* query;



after setting up that query, maybe in viewDidLoad or wherever you'd like the query to happen you'll need to do something like this.


//set up query task
self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURL URLWithString: "your URL"]]; 
self.queryTask.delegate = self; 

//set up query and options
self.query = [AGSQuery query]; 
self.query.outFields = [NSArray arrayWithObjects: "*", nil]; 
self.query.where = @"1=1";

//execute querytask with query 
[self.queryTask executeWithQuery: self.query];




with that in place you should reach
queryTask operation didExecuteWithFeatureSetResult retreivedFeatureSet
where you will have access to whatever was returned from your query.

Hope this helps.
0 Kudos
NicoleDe_La_Feld
New Contributor II
Thank you for your answer. I already did what you say and it's right.
The problem was that I accidentally deallocated the queryTask before the operation was completed.
0 Kudos