My app parses an online XML file. I am trying to add a feature that will scan the LINK from each item in the xml for certain keywords, and return them to an NSString. I set it up to do this when it parses using:
NSString *string = [NSString stringWithContentsOfURL:[NSURL URLWithString:articleUrl] encoding:NSUTF8StringEncoding error:nil];
NSMutableArray *substrings = [NSMutableArray new];
NSScanner *scanner = [NSScanner scannerWithString:string];
[scanner scanUpToString:@"Thought:" intoString:nil];
while(![scanner isAtEnd]) {
NSString *substring = nil;
[scanner scanString:@"Thought:" intoString:nil];
if([scanner scanUpToString:@"</body>" intoString:&substring]) {
[substrings addObject:substring];
}
[scanner scanUpToString:@"Thought:" intoString:nil];
}
[substrings release];
The issue is that the XML has many items, this takes time, and the TableView cells don't appear until after this task is completed. Is there a quicker way that could work?