In the CocoaXMLParser class of Apple's CocoaXMLParser example, the following code appears:
rssConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
[self performSelectorOnMainThread:@selector(downloadStarted) withObject:nil waitUntilDone:NO];
if (rssConnection != nil) {
do {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
} while (!done);
}
According to the NSRunLoop documentation "In general, your application does not need to either create or explicitly manage NSRunLoop objects. Each NSThread object, including the application’s main thread, has an NSRunLoop object automatically created for it as needed." In the context of this, why is the run-loop explicitly managed in this example? Would it not be created and destroyed automatically by the thread generated by the NSURLConnection request?