I have adopted an iOS app and am having problem asynchronous requests.
We have a WebService class that has the following code;
// create the request
NSURLRequest* request=[NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0];
self.connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (self.connection) {
self.receivedData = [NSMutableData data];
} else {
This seems like pretty vanilla NSURLRequest in a background thread. However, once this call goes out, it freezes up the UITableViewController. Maybe I’m misunderstanding what is supposed to happen but it seems like it should be able to scroll the table view. Is there anything wrong with the above code? One possibility that I’m debugging is that I’m using SDWebImage to downlowd thumbnails and the freezing might be due to downloading of said images but I would think this would take place in a background thread. Should the above NSURLRequest block the main thread and is there any way I can verify that I can verify that SDWebImage is the culprit here?
thx
Typical pattern for this is create the request. Set self to delegate and deal with response in delegate methods like so:
Or some such…. but then Im not sure where your calling all this stuff from… and you appear to be doing BOTH in the same method, which may or may not be connection:didReceiveResponse.