Re: Help with Background Tasks
Re: Help with Background Tasks
- Subject: Re: Help with Background Tasks
- From: Mark Bateman <email@hidden>
- Date: Thu, 19 Nov 2009 13:42:22 -0500
List,
OK to make my request a little more detailed. In my tableview "cell for row at index path" method I make several URL requests that fill in a cell within a section. E.G
section 1 - row 1 (1st url request)
section 1 - row 2 (2nd URL request), etc...
section 2 - row 1 (URL request Same as url request in section 1 but different data supplied)
section 2 - row 2 (URL request Same as url request in section 1 but different data supplied)
Obviously I want each URL request as it ends to update the correct index path table cell. I would like to send index path as one of the parameters so that when I perform the selector in background. I can modify that specific cell with that result. The method below only allows me one object, I'm not sure if the withObject:withObject: method will sole the problem if i create a compound selector with the @selector.
[self performSelectorInBackground:@selector(MakeURLRequest:) withObject:URLRequest];
All that said I would like to use URLconnection instead (as jens points out) they are asynch but again I have the problem of allocating the responses back to the correct index path object.
Jens,
Thanks..
On Nov 18, 2009, at 2:35 PM, Jens Alfke wrote:
>
> On Nov 18, 2009, at 11:21 AM, Mark Bateman wrote:
>
>> I am developing an App with a table that will hold URL content. I want to download that in the background and then have it update the table as it arrives.
>
> Don't do this using threads. Cocoa's networking APIs are asynchronous, so you can start a download using NSURLConnection and it will run in the background and notify your delegate when it's complete.
>
> You almost never need to start threads in Cocoa programming. This can be hard to adjust to if you come from other frameworks, esp. Java.
>
> —Jens
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden