Note that there are some explanatory texts on larger screens.

plurals
  1. PONSScanner - SLOW performance - (UITableView, NSXMLParser)
    text
    copied!<p>I've had a problem that 's been bugging me for a few days now. </p> <p>I'm parsing an RSS feed with NSXMLParser and feeding the results into a UITableView. Unfortunately, the feed returns some HTML which I parse out with the following method:</p> <pre><code>- (NSString *)flattenHTML:(NSString *)html { NSScanner *theScanner; NSString *text = nil; theScanner = [NSScanner scannerWithString:html]; while ([theScanner isAtEnd] == NO) { [theScanner scanUpToString:@"&lt;" intoString:NULL] ; [theScanner scanUpToString:@"&gt;" intoString:&amp;text] ; html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@&gt;", text] withString:@""]; } html = [html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; return html; </code></pre> <p>}</p> <p>I currently call this method during the NSXMLParser delegate method:</p> <pre><code>- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ </code></pre> <p>This works beautifully HOWEVER it takes almost a minute or more to parse and flatten the HTML into text and fill the cell. During that interminable minute my UITableView is entirely empty with just a lone spinner spinning. That's not good. This is last "bug" to squash before I ship this otherwise wonderfully working app.</p> <p>It's works pretty quickly on the iOS simulator which isn't surprising. </p> <p>Thanks in advance for any advice. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload