0

I recently upgraded my app to WKWebView, and since then my native plugins have stopped working. Specifically, the Camera and Geolocation plugin has stopped working. The worst thing is that no errors are 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.

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Vivek
  • 123
  • 7
  • Did you also _manually_ removed the `plugins` folder (located at the same level that the `platforms` folder) after removing the platform? If you installed the wrong version of a plugin and it's still there when adding the platform again, you'll probably end up with that same version installed again. – sebaferreras Sep 28 '18 at 16:48
  • @sebaferreras yes I did try removing both the platforms and the plugins folder together. Still the issue exists – Vivek Sep 29 '18 at 03:11

2 Answers2

0

Have you installed this cordova plugin "cordova-plugin-wkwebview-engine"?

Also we need to install "cordova-plugin-wkwebviewxhrfix" to handle xhr request.

Suresh Kumar Ariya
  • 9,516
  • 1
  • 18
  • 27
0

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.

Vivek
  • 123
  • 7