I am facing a weird problem in downloading xml files from server.
I am trying to get schedulist.xml using the following code,
- (void) downloadXml:(NSString*)url {
_urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[_urlRequest setHTTPMethod:@"GET"];
if(_urlConnection !=NULL)
return NO;
_urlConnection = [[NSURLConnection alloc] initWithRequest:_urlRequest delegate:self startImmediately:YES];
}
The problem is ,
- When internet is available , If I click the button to download xml,Fine. Xml is getting downloaded.
- Turned off the internet now, If I click the button again, it is calling
didReceiveResponse,didReceiveData and connectionDidFinishLoading.
FYI , I have deleted the old response data.
But the thing is , If I use [_urlRequest setHTTPMethod:@"POST"];
It is working fine, which is
- Working fine with internet
didFailWithError
is getting called
What could be the problem ?