The dissatisfaction of the delegates. How do I know when several delegates completed their task?

I built a basic XML XML parsing system based on Core XML, but I am confused about how to immediately launch several parsers, and I know when everything will be done.

This is my current setup, which receives only one parsed XML file ("news"). But I have some xml files that I need to parse ("sport", "shop", etc.). How would you turn it off and find out when it's all done?

// ViewController.m

DataGrabber *dataGrabber = [[DataGrabber alloc] init];
dataGrabber.delegate = self;
[dataGrabber getData:@"news"];


// DataGrabber delegate method (within ViewController) which gets called when dataGrabber has got all of the XML file
- (void) dataGrabberFinished:(DataGrabber *)dataGrabber
{
   NSManagedObjectContext *context = [self managedObjectContext];
   NSError *parseError = nil;
   // Parser puts the xml into core data. Do I need delegate on this too?
   Parser *xmlParse = [[Parser alloc] initWithContext:context];
   [xmlParse parseXMLFileWithData:dataGrabber.payload parseError:&parseError];
   [xmlParse release];
}

(this is a continuation of this question - Returning data from a data capture class from the Internet? )

+3
source share
1

, , , , . , .

, .

+3

Source: https://habr.com/ru/post/1769540/


All Articles