title: Thread still running of old view
body: <p>I have an app where there are five screens.</p>
  
  <p>On each screen, in viewDidLoad I am accessing data from server.</p>
  
  <p>On each screen I have next button.</p>
  
  <p>When I go from screen one to screen five (by clicking Next 4 times), in NSLog, I still see the process done by all previous four view controller.</p>
  
  <p>Is there any way, how can I kill those threads?</p>
  
  <p>In short, I don't want to do any process when I go away from that view i.e. <strong>if I go from view 3 to 4, I want to stop the task that I was for view 3</strong>.</p>
  
  <p>Getting data of earlier views &amp; waiting for that data (which is <strong><em>unwanted</em></strong>) is not good for app, hence I want like what I explained above.</p>
  
  <hr>
  
  <h2>Edit 1</h2>
  
  <p>Below is the code I use for reading the data.</p>
  
  <h2>.h</h2>
  
  <pre><code>@property(nonatomic, retain) NSMutableData *webData;
  @property(nonatomic, retain) NSMutableData *data;
  </code></pre>
  
  <p>Using below I request the data</p>
  
  <h2>.m</h2>
  
  <pre><code>NSString *myTMainURL = [NSString stringWithFormat:@"http://www.google.com"];
  NSURL *url = [NSURL URLWithString:myTMainURL];
  NSURLRequest *request = [NSURLRequest requestWithURL:url];
  [[NSURLConnection alloc] initWithRequest:request delegate:self];
  </code></pre>
  
  <p>For reading, below is how I read.</p>
  
  <pre><code>- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
      NSLog(@"didReceiveResponse");
      data = [[NSMutableData alloc] init ];
      [webData setLength: 0];
  }
  
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)theData {
      NSLog(@"didReceiveData");
      [data appendData:theData];
      [webData appendData:data];
      NSLog(@"didreceveidata leng===%d===%d", [webData length], [data length]);
  }
  
  - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
      NSLog(@"connectionDidFinishLoading");
  
      NSString *myDataFromLink = [[NSString alloc] initWithBytes: [data mutableBytes] length:[data length] encoding:NSUTF8StringEncoding];
  
      NSLog(@"myDataFromLink====%@--", myDataFromLink);
  
  }
  </code></pre>