I'm actually using the NSXMLParser
class for parse an XML file hosted on a server.
While the parser is doing his job I want to show a progress HUD grabbed there : https://github.com/jdg/MBProgressHUD
Here is how I show the Progress HUD :
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:NO];
hud.labelText = @"Update";
Then I start the parser using a class I have made :
[dm parseXMLAtURL:[NSURL URLWithString:@"myXML.xml.php"]];
Here is the full class method :
- (void)parseXMLAtURL:(NSURL *)XMLUrl {
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:XMLUrl];
[parser setDelegate:self];
NSLog(@"start");
[parser parse];
}
I obviously call the MBProgressHUD
before I parse the XML but there is no way : the MBProgressHUD
is shown when the parser finish his job.
I think this problem could be due to the stack management, when he do the longest job before others (parsing the full XML takes like 6-7 secondes) Am I right or it could be another stuff? And if I'm right how can I manage this?