I have an application which works fine on Xcode6-Beta1 and Xcode6-Beta2 with both iOS7 and iOS8. But with Xcode6-Beta3, Beta4, Beta5 I\'m facing network issues with iOS8 but
We had this exact error and it turned out to be an issue with the underlying HTTP implementation of NSURLRequest
:
As far as we can tell, when iOS 8/9/10/11 receive an HTTP response with a Keep-Alive
header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout
parameter of the Keep-Alive header (it seems to always keep the connection alive for 30 seconds.)
Then when a second request is sent by the app less than 30 seconds later, it tries to re-use a connection that might have been dropped by the server (if more than the real Keep-Alive
has elapsed).
Here are the solutions we have found so far:
KeepAliveTimeout
option.BrowserMatch "iOS 8\." nokeepalive
in the mod file setenvif.conf
)Connection: close
header: this will tell the server to drop the connection immediately and to respond without any keep alive headers. BUT at the moment, NSURLSession seems to override the Connection
header when the requests are sent (we didn't test this solution extensively as we can tweak the Apache configuration)