I got a problem with NSURLConnection and spent more than 3 days to find a solution but unfortunately, i haven't get one. Here is my code, this is in a dedicated class and use completehandler to return
NSURL *myUrl = [NSURL URLWithString:targetSite];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:myUrl
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:timeOutInterval];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:MYBODYCONTENT];
conn = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
if(conn)
{
webData = [NSMutableData data];
}
and use delegate to receive data, it works fine in "didReceiveResponse", "didReceiveData", "didFailWithError", "connectionDidFinishLoading", ...
BUT, if a request timeout happend, (i already did [conn cancel] in "didFailWithError")
then, in a peroid of time (I didn't do a precise count but about 1 min)
All my new request to the same server(request again) will be timeout again and again.
Is there anything I do wrong?
Or anything I should modify my code?
I have tried lots of solutions but still no go.
So, looking for some help, thanks.