I have the following code:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.lenzerheide.com/modules/weather/iphoneweather.php"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval: 10.0f];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
When I test the app on an iPhone, on some phones (probably those that haven't visited a page in mobile safari recently) the didFailWithError gets called with "the connection was terminted", not once, but always. But when I visit a site in mobile safari, this problem seems to go away completely for a few hours. I can even delete the app, reinstall it and the problem is still gone. It seems to take a few hours till this problem comes back up and than it's the same procedure, it only loads the XML after I visited a site in mobile safari first. If I don't do that, didFailWithError gets called all the time.
Oh and btw, the webpage hosting the xml is always working. I can load the XML on my Mac without any problems or even lags. Just on iPhones that haven't visited a page in mobile safari recently, I see the problem.
Any ideas?