4

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.

Rafthecalf
  • 461
  • 6
  • 20

2 Answers2

2

Contacted Apple support, this is actually done by design. WKWebView has been "optimized" to not make network connections while screen is locked.

Rafthecalf
  • 461
  • 6
  • 20
  • 1
    Would you please provide more details about this? I'm struggling with this same issue. – Mauro May 10 '19 at 17:14
0

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.

slotdp02
  • 438
  • 1
  • 6
  • 15