GitHub user akravchukabto edited a comment on the discussion: XHR requests are 
canceled in cordova-ios after the screen is locked

_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.
https://developer.apple.com/forums/thread/685525
States there are no "general purpose" background mechanism in iOS. Things just 
don't run in the background at all, however, specific APIs may have background 
modes. The NSURLSession is one API that does have a background mode so a 
request that has been started while the app in the foreground should continue 
to upload and/or download if the app goes into the background. See 
https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1407496-backgroundsessionconfigurationwi?language=objc
 for more info on this.
You won't be able to rely on the browser's fetch/XMLHttpRequest APIs, but 
rather use a plugin that interfaces with the native API, and that API must set 
up a background networking task. I've never used this so I don't know if there 
are any caveats but I assume it's not really a good idea to assume that every 
request can be a background task. My guess the cordova-plugin-advanced-http 
plugin doesn't do this.

GitHub link: 
https://github.com/apache/cordova/discussions/459#discussioncomment-7994047

----
This is an automatically sent email for issues@cordova.apache.org.
To unsubscribe, please send an email to: issues-unsubscr...@cordova.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to