Need Help!!!
Guys, i am using Parse for cloud data backend for my app. Have a parse class with column type as file. It stores images. In my application i need to fetch all images available in this column and store in a array.
Next is the error and code sample. Per my understanding it fails on findObjectsInBackgroundWithBlock. Please help
Error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This query has an outstanding network connection. You have to wait until it's done.’
Code:
(PFQuery *)queryForTable { NSLog(@"queryForTable *ENTER ");
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName]; [query whereKey:TAB_PARSE_WHERE_KEY equalTo:self.tShelfID];
// If no objects are loaded in memory, we look to the cache first to fill the table // and then subsequently do a query against the network. if ([self.objects count] == 0) { query.cachePolicy = kPFCachePolicyCacheThenNetwork; }
NSLog(@"queryForTable *** 1 ** ");
[query cancel]; //cancels the current network request being made by this query (if any) [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
NSLog(@"queryForTable *** 2 ** "); if (!error) { // The find succeeded. NSLog(@"Successfully retrieved "); //for (PFObject *object in objects) { //NSLog(@"INSIDE FOR LOOOP"); //NSLog(@"%@", object.bookId); //} } else { // Log details of the failure NSLog(@"Error: %@ %@", error, [error userInfo]); }}];
//[query orderByAscending:TAB_PARSE_ORDER_KEY];
NSLog(@"queryForTable *EXIT "); return query;
}