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 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.
-
Can you, please, clarify if this is expected behaviour for xhr requests to be canceled when the screen is locked on cordova for ios devices?
-
Are there any workarounds to deal with this issue – I mean, user starts save request, locks the screen, and request is completed successfully?
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
Thank you for any help.