问题描述:

The code is the following, however I can't figure out why it's not timing out even after 10 seconds has passed. Any idea?

__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:sourceURL];

[request setTimeOutSeconds:5.0];

[request setDelegate:self];

[request setCompletionBlock:^{

//some code

}];

[request setFailedBlock:^{

//some code

}];

self.currentRequest_ = request;

[self.currentRequest_ startAsynchronous];

- (void)requestFailed:(ASIHTTPRequest *)request {

NSLog(@"FAILED");

}

网友答案:

Perhaps the request completed successfully then?

Other possibility is that there was data being received at least every 5 seconds, but the full data has not yet been received. ASI will only timeout if nothing is received for the timeout period, so if data is constantly arrived the request won't time out.

网友答案:

I don't think you call -[ ASIHTTPRequest startAsynchronous]... Instead add the request (which is a subclass of NSOperation) to a ASINetworkQueue (a subclass of NSOperationQueue). HTH

相关阅读:
Top