3

从相机拍照后,这些路径就来了。

file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg

我使用的是 Ionic 4,其中 WebView 是 2.2.3,通过应用观察到所有类型的回复,但没有效果。

"cordova-plugin-ionic-webview": "2.2.3"

我曾经回答过这个

不允许加载本地资源:ionic 3 android

所以我没有在设备上显示应用程序,这个不一样。

Failed to load resource: net::ERR_FILE_NOT_FOUND
4

2 回答 2

2

我找到了我的问题的解决方案。

我已经完成了这个工作完美的链接。

https://devdactic.com/ionic-4-image-upload-storage/

而在我的 config.xml 中,extra 没有写任何东西。

简而言之:不支持新的 webview 插件file:/// url

首先转换urlhttp://localhost:<post>/url 使用这个函数this.webview.convertFileSrc(img);

像这样返回这个函数值http://localhost:8080/_file_/data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg

我的建议使用上面的链接来解决同样的问题......

于 2018-11-21T14:24:21.260 回答
0

请尝试将此添加到您的 config.xml:

 <access allows-arbitrary-loads-for-media="true" allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*"/>
 <allow-navigation href="data:*"/>
 <allow-navigation href="*"/>
于 2018-11-21T07:48:19.317 回答