3
在我的項目中,我使用AFNetworking進行Api調用,如何確定AFNetworking的默認超時秒數。請建議。AFNetworking的默認超時秒數?
在我的項目中,我使用AFNetworking進行Api調用,如何確定AFNetworking的默認超時秒數。請建議。AFNetworking的默認超時秒數?
爲AFNetwork
默認超時是60秒
如果你想減少超時超時時間間隔(秒)。如果在連接嘗試期間 請求空閒時間超過超時間隔,則認爲請求 超時。默認的超時時間間隔爲60秒鐘。
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
}];
任何查詢....? –
而*請*展示你試圖解決您的問題。 – D4V1D
默認超時秒數:60 –