This is happening on Ionic 3 with Ionic Native 4 packages, on an iOS device.
According to our session viewing tool, we have a bunch of failed accesses to cordova plugins when the user resumes using their device (maybe iOS had backgrounded it prior?):
I have also seen quite a few errors reported through Rollbar, seemingly related to the Ionic webserver:
request.url: ionic://localhost
Error: Uncaught (in promise): TypeError: A server with the specified hostname could not be found.
request.url: ionic://localhost
Error: Uncaught (in promise): TypeError: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.ionicjs.com” which could put your confidential information at risk.
ionic://localhost Uncaught (in promise): TypeError: The request timed out.
ionic://localhost Uncaught (in promise): TypeError: The network connection was lost.
These happen quite often (in the tens of thousands), and I believe these to be related to an issue where the initial http requests made when a user resumes the device return a “Network error” status 0 until they hard kill their device, at which point everything starts working again.
Do I need to be calling platform.ready
prior to every usage of a cordova plugin? Is this expected behavior due to “backgrounding” logic? What is happening that is causing all these attempts to access native plugins to fail initially?