XHR requests are canceled in cordova-ios after the screen is locked #459
Replies: 1 comment
-
Reply I got from Norman Breau in cordova slack channel: I don't know about that specifically but iOS is known to limit background tasks pretty significantly. I'm pretty sure all WKWebView process stuff is paused if the app goes into the background and I don't think there is any real way around that, making browser-based solutions not appealing. |
Beta Was this translation helpful? Give feedback.
-
Hi,
in our cordova ios app there is a case, when user can save form using xhr request.
In normal scenario when the Iphone screen is not locked after starting the save request - everything works fine.
But when the screen gets locked right after starting save request - request fails with error - Failed to load resource: The network connection was lost
I have made some research on this issue and found https://stackoverflow.com/questions/43505618/failed-to-load-resource-the-network-connection-was-lost-safari
It is said that WKWebView has been "optimized" to not make network connections while screen is locked
As far as I understand cordova-ios is using WKWebView so it may inherit this limitation.
I have also tried using advanced http plugin https://github.com/silkimen/cordova-plugin-advanced-http#readme - the request is not canceled immediately, but when the time spent in background exceeds timeout - request is canceled by timeout.
The issue is observed on IOS platform only.
The issue is reproduced only on real device.
cordova ios version 6.3.0
Thank you for any help.
Beta Was this translation helpful? Give feedback.
All reactions