I would like to know what happens behind the scenes when a user locks and unlocks the iPad screen. I have an application that downloads files using NSURLConnection, and the download fails with a SOAP error ("Could not find a server with the specified hostname"), but not when the user locks the screen, but when he unlocks it. No matter when the error appears, the download never ends. Any ideas why and what can be done about this?
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:300]; NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest: request delegate: self];
From what I can say, when I click the Home button, I get:
applicationWillResignActive applicationDidEnterBackground
and after I remember the application after three minutes, I get:
applicationWillEnterForeground
and the download is already completed or progressing even in the background.
When I leave it in the background for longer (5 minutes), it gives an error message.
When I lock the screen, I get the same order of state of the application, but also an error message disabling download.
Thanks!
source share