Cannot display image from local in Cordova / iOS

1k Views Asked by At

My Cordova app has to display image from local file. It worked fine until I had to move on to Cordova 10 and WKWebView.

I know have the following message :

Get file:///var/mobile/Containers/Data/Application/93F87A6C-0069-4190-ACA5-C5EF7F5D1C8F/Library/NoCloud/story__le-petit-chaperon/page-93fd607b-3f9b-42bf-89d4-09def7874b72.jpg The operation couldn’t be completed. Operation not permitted

I have installed plugin with no success https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix

I also tried some scheme solution described here Cordova + cordova-ios 6.1.0 - load local image but it screws all the path : angular templates cannot be loaded, navigation issues...

I am lost and frustrated for something that worked perfectly. Any help would be greatly appreciated. Thanks !

1

There are 1 best solutions below

5
On

Try cordova-plugin-ios-xhr instead then set your preferences like

 <preference name="allowFileAccessFromFileURLs" value="true" />
 <preference name="allowUniversalAccessFromFileURLs" value="true" />