Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default timeout seconds for AFNetworking?

In my project I have used AFNetworking for Api calls, How to identify the default timeout seconds for AFNetworking. Please suggest.

like image 406
Ari Haran Avatar asked Dec 05 '22 02:12

Ari Haran


1 Answers

the default timeout for AFNetwork is 60 seconds

The timeout interval, in seconds. If during a connection attempt the request remains idle for longer than the timeout interval, the request is considered to have timed out. The default timeout interval is 60 seconds.

additional reference

if you want to decrease the timeout

NSDictionary *params = @{@"par1": @"value1",
                     @"par2": @"value2"};

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

[manager.requestSerializer setTimeoutInterval:25];  //Time out after 25 seconds

[manager POST:@"URL" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {

//Success call back bock
NSLog(@"Request completed with response: %@", responseObject);


} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
 //Failure callback block. This block may be called due to time out or any other failure reason
}];
like image 79
Anbu.Karthik Avatar answered Dec 25 '22 21:12

Anbu.Karthik