NSXMLParser parserDidStartDocument freezes app

Dlatman

New Member
I tried to add some operations after call\[code\]- (void)parserDidStartDocument:(NSXMLParser *)parser {//NSLog(@"found file and started parsing");alertView = [[UIAlertView alloc] initWithTitle:@"Caricamento..." message:@"\n" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];spinner.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur[alertView addSubview:spinner];[spinner startAnimating];[alertView show];\[/code\]}But it freeze the app for a while, and then, when finished the XML parse, loads the AlertView, ecc. Same thing with the UIRefreshControl. I slide down the tableView, and the app freeze while parsing, I cant see the spinner rotating.Any idea?Edit:here I call the first time the parser:\[code\]- (void)viewDidAppear:(BOOL)animated {[super viewDidAppear:animated];NSString * path = @"thexmlpath.xml";if(!caricato) [NSThread detachNewThreadSelector:@selector(parseXMLFileAtURL:) toTarget:self withObject:path]; //[self parseXMLFileAtURL:path];caricato = YES;}\[/code\]Here I call when I use the RefreshControl:\[code\]- (void)refreshControlRequest{NSLog(@"refreshing...");NSString * path = @"thexmlpath.xml";[self performSelector:@selector(parseXMLFileAtURL:) withObject:path];}\[/code\]
 
Back
Top