NSMUABLEURLRequest SetTimeOutInterval Problema
-
30-10-2019 - |
Domanda
Ok in primo luogo se utilizzo un nsurlreuqest (non mutabile) come segue, la connessione fa il timeout di conseguenza a ciò che è stato impostato. La cosa strana è perché l'NSLOG legge sempre 0?
self.requestURL = [NSURLRequest requestWithURL:[NSURL URLWithString:requestString]cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
NSLog(@"request timeOutInterval:%d", self.requestURL.timeoutInterval); // always 0
Successivamente, faccio qualcosa del genere e TimeOutInterval non viene impostato.
self.requestURL = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:requestString]] autorelease];
[self.requestURL setTimeoutInterval:20];
NSLog(@"request timeOutInterval:%i", self.requestURL.timeoutInterval); // same thing always 0 here.
MODIFICARE. Sto usando %F per registrare ora la proprietà TimeOutInterval ed entrambi recitano 20.000. Ma il vero problema è perché il mio mio nsmutableurlrequest non ha sparato al - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
Metodo di richiamata delegato quando raggiunge il timeoutinterval (20S). Invece è scaduto solo intorno ai 75. Ancora più a lungo del valore predefinito degli anni '60 ...
Anche se rimuovo il [self.requestURL setTimeoutInterval:20];
Linea, la connessione è ancora timeout a 75 secondi.
Ho provato
self.requestURL = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:requestString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0] autorelease];
Nessuna soluzione corretta