For now I am parsing a XML file like the example from Apple (LazyTableImages). Everything works fine. I’d like to add a real-time search (UISearch) which has to parse another XML file (specially programmed for the search). How can I parse this file without freezing the screen?
Share
You use a GCD and dispatch a block to do this while parsing in the background (and maybe showing a spinner). Your XML parser delegate should be looking at a “cancel” flag, so if the user does something like hit cancel or the back button, you cancel the xml parsing immediately and allow the current operation to stop.
EDIT: So you will have an ivar to hold the NSXMLParser, and a method in your class that is called when the parsing is complete:
If the user types cancel (suppose XML object is huge, and it takes many seconds to parse), then you would in the action method simply send