title: NSURLConnection & UIProgressView
body: <p>In my "didFinishLaunchingWithOptions" method, I have created a UIProgressView in my GUI &amp; after that I call a method to call a WebService with a NSURLConnection to get an XML with a SOAP message.</p>
  
  <p>In the delegate method "connectionDidFinishLoading" I parse the XML with NSXMLParser in another class.</p>
  
  <p>The problem is that I want to update my UIProgressView while the XML is parsed, but it is updated after the whole XML has been parsed. I have heard this is because the NSURLconnection run on the main thread and is blocking the UI.</p>
  
  <p>How can I parse and update the progress bar in the same time ?</p>
  
  <pre><code>- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
  
  NSString * theXML = [[NSString alloc] initWithBytes:[webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
  
  NSLog( @"The XML : %@", theXML );
  
  [theXML release];
  
  theXmlParser = [[NSXMLParser alloc] initWithData:webData];
  
  XMLParser * theParseur = [[XMLParser alloc] initXMLParser];
  
  [theXmlParser setDelegate:theParseur];
  
  [theXmlParser setShouldProcessNamespaces:NO];
  [theXmlParser setShouldReportNamespacePrefixes:NO];
  [theXmlParser setShouldResolveExternalEntities:NO];
  
  NSLog(@"Begin parsing...");
  
  BOOL success = [theXmlParser parse];
  
  if( success ) {
  
      // my code...
  
  } else {
  
      NSLog(@"XML partner : End Parsing &gt; ERROR : %@", [[theXmlParser  parserError] localizedDescription] );
  
      [theXmlParser release];
  }
  
  [connection release];
  [webData release];
  }
  </code></pre>