0

I can able to download a file when an URL is given using the delegate methods of NSURLConnection. When a download is active, its download progress like percentage downloaded, transfer rate, bytes received are shown in the UITableView. So, when I initiate a download, the first cell of the table is active till the download completes. Everything is perfect for a single download.

My problem is, I have no idea how to handle multiple asynchronous downloads. If the URL is given when a download is active, the second cell of the table should be activated and the progress should be shown. I surfed many blogs and forums regarding this. Many suggested to use ASIHTTPRequest. But I am trying to handle the NSURLConnections in an array and hit the requests. When I tried, the first active download is overridden by the second request.

Please help me with some ideas to deal this problem using array, without ASIHTTPRequest. Thank you in advance.

iOS
  • 3,526
  • 3
  • 37
  • 82
  • possible duplicate of [Managing multiple asynchronous NSURLConnection connections](http://stackoverflow.com/questions/332276/managing-multiple-asynchronous-nsurlconnection-connections) or http://stackoverflow.com/questions/2334981/strange-multiple-files-download-nsurlconnection – Vladimir Jul 07 '11 at 14:16
  • If everyone says use ASIHTTPRequest, why don't you want to? – deanWombourne Jul 07 '11 at 15:28

1 Answers1

0

Assuming that you're making multiple NSURLConnection objects, one per request just store the connection that each table view cell is referring to in an array.

Then, when the delegate methods are called, they should all pass back the connection object that they are referring to i.e. connection:didReceiveData:'s connection parameter.

You can use this parameter to work out which table cell this delegate call is referring to.

deanWombourne
  • 38,189
  • 13
  • 98
  • 110