Using any form of progressHUD (SV, MB, etc) I run into this problem where the HUD is either hidden right after it is displayed or stays there permanently. In the below example, the HUD stays permanently, regardless of if the twitter feed (or page for other view controllers) has finished loading. How can I make the HUD disappear after the task in the separate thread completes?
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
//Sets the auth key (user or app) for the RMACC Twitter Feed
STTwitterAPI *twitter = [STTwitterAPI twitterAPIOSWithFirstAccount];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *username) {
[twitter getUserTimelineWithScreenName:@"RMACCNewsNotes" count:10 successBlock:^(NSArray *statuses) {
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
self.twitterFeed =[NSMutableArray arrayWithArray:statuses];
[self.tableView reloadData];
} errorBlock:^(NSError *error){ }];
} errorBlock:^(NSError *error) {
[self twitterselfauthrequest];
}];
});
}