Ionic Native geolocation and camera stopped working after upgrading to WKWebView

Hello everyone,

I recently upgraded my app to WKWebView and since then my native plugins have stopped working. Specifically, the Camera and Geolocation plugin have stopped working. The worst thing is that there are no errors being thrown. I tried console logging every step and apparently, the promise geolocation.getCurrentPosition() is never being resolved.

Also, I’m getting a warning stating my plugins are in an inconsistent state and device ready is not fired within 5000ms.

I tried the following things:

  1. Uninstalling plugins one by one using ionic cordova plugin rm, now the device ready event is fired after 8 seconds but at least it’s fired.
  2. Running the app in a browser or an iOS simulator works fine and both the camera and the geolocation work.
  3. Tried creating a new app and tried to reproduce the bug but it works in the new app.
  4. Tried removing platform android and adding it again.

My app was working fine before upgrading. I upgraded to WKWebView because one feature wasn’t working on iOS. Ever since I did that my native plugins have stopped working. Is there any way to fix this. I have a git repository and I can rollback this commit but I think the problem is with the files that are in gitignore.

I managed to fix it by uninstalling the cordova-plugin-ionic-webview with the following command.

cordova plugin rm cordova-plugin-ionic-webview

After that I had some issues with Firebase Authentication so I ran the following command:

cordova plugin add cordova-plugin-whitelist

I don’t know what was causing the issue yet. But apparently WKWebView doesn’t work with native plugins on Android. Now I need to find a workaround to add WKWebView on iOS.