In my ios app i am using GCD calls to download some data in background threads , but its not updating UI instantly, I should touch the screen to update UI , following is my code, shall I know why table view is not reloaded though I am trying to Update in Main thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//background processing goes here
// Downloading JSON data from Web APIs
dispatch_async(dispatch_get_main_queue(), ^{
//update UI here
//Reloading my table view
[objTableView reloadData];
});
});
I have also tried runOnMainQueueWithoutDeadlocking
instead of dispatch_async(dispatch_get_main_queue()
but its of no use
void runOnMainQueueWithoutDeadlocking(void (^block)(void))
{
if ([NSThread isMainThread])
{
block();
}
else
{
dispatch_sync(dispatch_get_main_queue(), block);
}
}