Duplicate of :
have implemented an iOS App using Parse.com
Trying to retrieve from cache.
While retrieve data from cache i got an error like this:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This query has an outstanding network connection. You have to wait until it's done.'
When i browse for the issues i found that:
Some suggested that it may happens due to making two query calls on the same query object without waiting for the first to complete.
how to avoid these simultatanius calls in this app
query setLimit: limit]; [query setSkip: skip];
//RETRIEVING FROM CACHE query.cachePolicy = kPFCachePolicyCacheThenNetwork; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { [allObjects removeAllObjects]; //Added regarding cache ****** // The find succeeded. Add the returned objects to allObjects [allObjects addObjectsFromArray:objects]; if (objects.count == limit) { // There might be more objects in the table. Update the skip value and execute the query again. skip += limit; [query setSkip: skip]; // Go get more results weakPointer(); } else { // We are done so return the objects block(allObjects, nil); } } else { block(nil,error); } }];