Reputation: 461
Making XMLHttpRequests in iOS WKWebView when idle (in background) and locking screen causes the request to error out and we get this in the safari console log:
Failed to load resource: The network connection was lost
Does anyone know why Safari closes the connection? Or is it the server closing the connection?
Any help would be greatly appreciated.
Upvotes: 4
Views: 4123
Reputation: 461
Contacted Apple support, this is actually done by design. WKWebView has been "optimized" to not make network connections while screen is locked.
Upvotes: 2
Reputation: 438
Are you by chance using Angular and also getting this error:
0 - {"isTrusted":true}
I have been getting the error you are getting along with this one.
In any sense I found this answer helpful because it's probably a CORS issue:
{"isTrusted":true} exception in core.umd.js
Hope that at least points you in the right direction.
Upvotes: 0