I'd like to know what's happening behind the scenes when the user locks and unlocks the iPad screen. I have an app that downloads files using NSURLConnection and the downloads fail with a SOAP error ("A server with the specified hostname could not be found"), but not when the user locks the screen, but when it unlocks it. Regardless of the fact when the error pops up, the download never finishes. Any ideas why and what could be done about it ?
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:300];
NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest: request delegate: self];
From what I can tell, when I hit the Home button I get:
applicationWillResignActive
applicationDidEnterBackground
and after I recall the app after three minutes I get:
applicationWillEnterForeground
and the download is either already finished or has progressed even in the background.
When I leave it in the background longer (5 minutes) it times out with an error.
When I lock the screen I get the same order of application states, but also an error message about the download disconnection.
Thank you!