I am basically trying to reload the UITableView data using blocks when the data is loaded back in a non-blocking fashion.
[query findObjectsInBackgroundWithBlock:^(NSArray * objects, NSError * error){
if (!error){
for (PFObject * vote in objects){
if([vote objectForKey:@"note"]){
NSString * username = ((PFUser *)[vote objectForKey:@"voter"]).username;
NSLog(@"Username is %@", username);
[self.notes addObject:[NSDictionary dictionaryWithObject:[vote objectForKey:@"note"] forKey:username]];
NSLog(@"Note is %@", [vote objectForKey:@"note"]);
}
}
[self.tableView reloadData];
}
//[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
}];
The issue is that the following code will generate an error of:
bool _WebTryThreadLock(bool), 0x246d20: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
this is inside my cellForRowAtIndexPath:

Why is this and how do I fix this?
The error is telling you that a certain method must be run on the main thread (or the web thread, to which you don’t have access). Since
reloadDatatriggers this method eventually, one way to solve this would be to makereloadDataexecute on the main thread: