First Query Slow

The first query that my app performs is slow to respond when using an iOS device. When using the iOS simulator the response is immediate. The query returns 6 rows of 5 columns, 4 short strings and 2 numbers. All the preceding queries return almost immediately even though they are returning more data.
Any ideas on why this is happening or any suggestions to improve the response of the first query.
My query looks like this
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

QueryOptions *query = [QueryOptions query];

BackendlessDataQuery *dataQuery = [BackendlessDataQuery query:nil where:nil query:query];

Responder *responder = [Responder responder:self selResponseHandler:@selector(responseHandler:) selErrorHandler:@selector(errorHandler:)];

[backendless.persistenceService find:[Stores class] dataQuery:dataQuery responder:responder];

Hi Charles,

From the backend perspective there is nothing special about the first query, it is executed the same way as any other one. Could you check if perhaps removing the following line would make any difference?
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

Regards,
Mark

I was able to solve this by moving the query to a function that gets called after the “ViewDidLoad” function. iOS seems to be blocking the query and slowing it down. This was not an issue with Parse. I tried calling the query before the “ViewDidLoad” function but that was also slow.

Thanks for your prompt reply.

I have a same problem the response on the Ios device is quite slow compare to stimulator, anyone know why ?

In my case I needed to wait for the location manager and map to load and then perform the query. Moving the query fixed the problem, I had to try a couple different locations before I found one that worked.

Consider changing the code to use the asynchronous (non-blocking) version of the same API.

I am using the asynchronous version of the API. I was able to solve the issue by moving the code to a different function and it didn’t impact the functionality of my app.