我正在使用Ionic 3 Android Build APK并尝试从文件中删除图像:///storage/emulated/0/data/io.ionic.vdeovalet/cache/image.jpeg
拍照(源类型){
尝试{
//为“摄影机”对话框创建选项
变量选项={
质量:100,
目标类型:this.camera.destinationtype.file_uri,
编码类型:this.camera.encodingtype.jpeg,
sourcetype:sourcetype,
};
this.camera.getpicture(选项)。然后((imagepath)=>{
//android库的特殊处理
if(this.platform.is('android')&&sourcetype===
this.camera.picturesourceType.photolibrary{
this.filepath.resolvenativepath(映像路径)
。然后(文件路径=>{
设correctpath=filepath.substr(0,filepath.lastindexof('/')+1);
设currentname=imagepath.substring(imagepath.lastindexof('/')+1,
imagepath.lastindexof('?');
this.copyFileToLocalDir(correctPath,currentName,this.createFileName());
this.lastImage=文件路径;
(});
}其他{
var currentname=imagepath.substr(imagepath.lastindexof('/')+1);
var correctpath=imagepath.substr(0,imagepath.lastindexof('/')+1);
this.copyFileToLocalDir(correctPath,currentName,this.createFileName());
}
},(错误)=>{
this.presenttoast('选择图像时出错');
(});
}捕获(e){
控制台错误(E);
}
}
错误:不允许加载本地资源
安卓6.0.1

最佳答案

我也有同样的问题
新的Ionic WebView插件是问题的原因。
新插件:Cordova插件Ionic Webview@2.x看起来不稳定…
为了让它工作降级回Cordova插件Ionic Webview@1.2.1,所有的都应该工作
步骤:
1。卸载WebView

ionic cordova plugins rm cordova-plugin-ionic-webview

2。安装旧版本:
ionic cordova plugins add cordova-plugin-ionic-webview@1.2.1

三。干净的科尔多瓦
cordova clean android

08-05 21:20