title: Error message that UIKit should not be called from a secondary thread
body: <p>I have an app which uses a <code>UISearchBar</code> to dynamically search from an external API based on user input. </p>
  
  <p>The app is searching the external API fine and displaying results correctly, but when I  select any row from the search results, the screen freezes and I am getting this error;</p>
  
  <blockquote>
    <p>Tried to obtain the web lock from a thread other than the main thread or the web thread
    UIKit should not be called from a secondary thread</p>
  </blockquote>
  
  <p>I have absolutely no idea how I can fix this. </p>
  
  <p>Here is the code;</p>
  
  <pre><code>- (void) run: (id) param  {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  
      NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL: [self URL]];
      [parser setDelegate: self];
      [parser parse];
      [parser release];
      [delegate parseDidComplete];
      [pool release];
  } 
  
  - (void) parseXMLFile: (NSURL *) url
  { 
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      [self setURL: url];
      NSThread* myThread = [[NSThread alloc] initWithTarget:self
                                                   selector:@selector(run
     object: nil];
      [myThread start];
      [pool release];
  }
  </code></pre>