2015-09-15 26 views

回答

12

AFNetwork默認超時是60秒

超時時間間隔(秒)。如果在連接嘗試期間 請求空閒時間超過超時間隔,則認爲請求 超時。默認的超時時間間隔爲60秒鐘。

額外reference

如果你想減少超時

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 
}]; 
+0

任何查詢....? –