Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What delegate method is called when an ASI-HTTP-Request times out?

I have an app that uses ASI-HTTP-Request for large files, and I had a tester recently note that they wer observing very long loading delays that should be manifesting as timeouts. I have delegate methods wired up for request failures, but these didn't seem to be happening.

I poured through their documentation but didn't see anything specific.

like image 998
M. Ryan Avatar asked Jan 21 '23 16:01

M. Ryan


1 Answers

In ASIHTTPRequest.m, look in the -checkRequestStatus method.

When a timeout occurs, the request fails with an ASIRequestTimedOutError error type:

[self failWithError:ASIRequestTimedOutError];

So you should be able to check the error returned in the delegate's -requestFailed: method:

- (void)requestFailed:(ASIHTTPRequest *)request {
    NSLog(@"Error: %@",[[request error] localizedDescription]);
}

It's a good idea to read through the source to get a rough feel for how things work. The documentation is great, but not always in sync with the source code.

like image 61
Alex Reynolds Avatar answered Apr 09 '23 04:04

Alex Reynolds