I am sure this is a problem with my iOS / ObjC noob-ness ...
I have a UITableView with entries when the user selects a row,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... [self.twitter sendUpdate:[self getTweet]];
and
- (NSString *)sendUpdate:(NSString *)text; { NSLog(@"showing HUD"); self.progressSheet = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication] keyWindow] animated:YES]; self.progressSheet.labelText = @"Working:"; self.progressSheet.detailsLabelText = text; // Build a twitter request TWRequest *postRequest = [[TWRequest alloc] initWithURL: [NSURL URLWithString:@"http://api.twitter.com/1/statuses/update.json"] parameters:[NSDictionary dictionaryWithObject:text forKey:@"status"] requestMethod:TWRequestMethodPOST]; // Post the request [postRequest setAccount:self.twitterAccount]; // Block handler to manage the response [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { NSLog(@"Twitter response, HTTP response: %i", [urlResponse statusCode]); NSLog(@"hiding HUD"); [MBProgressHUD hideHUDForView:[[UIApplication sharedApplication] keyWindow] animated:YES]; self.progressSheet = nil;
He calls the built-in Twitter avi to send a tweet. I am using MBProgressHUD while submitting. I get erratic behavior with the HUD disappearing, it usually hangs for about 10 or more seconds longer than necessary. Based on the show / hide entry, I see.
I have another, simpler view that lists only tweets and it uses the HUD without any problems - although this is done through a viewWillAppear call.
Maybe I need to do a show through another thread?
Thanks in advance for any thoughts ~ chris
source share