WKWebView not showing image preview


Sorry if the category does not match my kind of post.

I am building an app in Ionic 4. Recently, I’ve been working on trying to get the user to take a picture and upload it. I have followed the Ionic 4 images tutorial: https://devdactic.com/ionic-4-image-upload-storage/ . However, there is one problem I cannot seem to fix: whatever I try, as soon as the user took a picture with the camera or selected one out of the image gallery, the list that’s supposed to provide a preview of the image does not display the image:https://imgur.com/a/6FCXNgD

I have already tried to get rid of node modules and app plugins, reinstalling those. I have also created an app from scratch, only implementing the tutorial - however, the same error showed up.

Not unimportant: when I run the app on iPhone DevApp using ‘ionic serve --devapp’, the image preview list does not add an item at all (the exact error is on the function this.webview.convertFileSrc(img); ) and the following warnings are displayed:

[ng] [console.warn]: "Native: tried calling WebView.convertFileSrc, but the WebView plugin is not installed."
[ng] [console.warn]: "Install the WebView plugin: 'ionic cordova plugin add cordova-plugin-ionic-webview'"

… which is also curious because that plugin is, in fact, installed (present in both node_modules and plugins of the iOS platform folder).

I’ve been stuck on this for a few weeks now. Any help would be immensely appreciated. Thank you!

According to the docs, in capacitor applications (and your app is most likely is) some of the cordova plugins cannot be used https://capacitor.ionicframework.com/docs/cordova/known-incompatible-plugins/

In this particular case, converFileSrc method can be invoked like this:

import { Capacitor } from '@capacitor/core';


Please refer https://ionicframework.com/docs/building/webview