0
votes

I am using NSXMLParser to parse some xml data. I am using some delegate method like,

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict 
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName 
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string 

This NSXMLParser is in MYAppDelegate.m, Now I want to reload the UI after completing the parsing on Home.m, also I start activity indicator when I request to web service and stop it in didEndElement. But I noticed sometimes found character dosen't get called and My UI freezes. I want to update my UI after parsing is completed. How I can do this? Thanks in advance.

3

3 Answers

2
votes

You can try to reload your view in:

Sent by the parser object to the delegate when it has successfully completed parsing:

- (void)parserDidEndDocument:(NSXMLParser *)parser

Sent by a parser object to its delegate when it encounters a fatal error. When this method is invoked, parsing is stopped:

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
0
votes

You can create an NSOperation subclass and try to parse XML in that class to avoid UI freezing more info how to achieve this , take a look here NSOperaion

to redraw UIView call [self.view setNeedsDisplay];

-1
votes

When your app's

- (void)parserDidEndDocument:(NSXMLParser *)parser

is called then you want to do

[self reloadView];

or whatever your reload method is.