Mam następujący problem. Na wartości NSMutableURLRequest
przy użyciu metody HTTP
metoda ustawiona dla połączenia jest ignorowana. Jeśli internet ma problem (zły, złe proxy DNS) URL żądania nie powiedzie się po około 2-4 minut, ale nie z NSLocalizedDescription = "timed out";
Limit czasu NSMutableURLRequest nie jest brany pod uwagę przy żądaniach POST
NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork Code=-1001 UserInfo=0x139580 "The request timed out.
Jeśli metoda http
stosowany jest GET
to działa dobrze. Połączenie to async
przez https
.
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setTimeoutInterval:10];
//Set the request method to post
[request setHTTPMethod:@"POST"];
if (body != nil) {
[request setHTTPBody:body];
}
// Add general parameters to the request
if (authorization){
[request addValue: authorization forHTTPHeaderField:@"Authorization"];
}
[request addValue: WS_HOST forHTTPHeaderField:@"Host"];
[request addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[self addToQueueRequest:request withDelegate:delegate];
'
Spróbuj utworzyć obiekt NSMutableURLRequest za pomocą requestWithURL: cachePolicy: timeoutInterval: class method? – catsby