作者:郭洁蓉4071_878 | 来源:互联网 | 2023-08-26 11:32
从相机拍摄照片后,这些路径来了.file:datadataxxx.xxx.xxx.xxxfiles1542782360167.jpg我使用Ionic4,其中WebView是2.2.
从相机拍摄照片后,这些路径来了.
file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg
我使用Ionic 4,其中WebView是2.2.3,所有类型的回复都通过应用观察到但没有效果.
"cordova-plugin-ionic-webview": "2.2.3"
我曾经回答过这个问题
Not allowed to load local resource: ionic 3 android
所以我没有在设备上显示应用程序,这个不一样.
Failed to load resource: net::ERR_FILE_NOT_FOUND
解决方法:
我找到了解决问题的方法.
我已经完成了这个完美的链接.
https://devdactic.com/ionic-4-image-upload-storage/
在我的config.xml中,extra没有写任何东西.
简而言之 :
新的webview插件不支持file:/// url
首先将网址转换为http:// localhost: / url
使用此函数this.webview.convertFileSrc(img);
像这样返回这个函数值http:// localhost:8080 / _file_ / data / data / xxx.xxx.xxx.xxx / files / 1542782360167.jpg
我的建议使用上面的链接来解决同样的问题……