[英]Error: “Not allowed to load local resource” when using navigator.camera.getPicture()
I'm using Corodva 2.3.0 and an Android 2.3.3 virtual device. 我正在使用Corodva 2.3.0和Android 2.3.3虚拟设备。 In my Cordova enabled app I am trying to take a picture and then have that picture display on the page.
在启用了Cordova的应用程序中,我试图拍照,然后在页面上显示该图片。 In my "Take Picture" button I am running the following code:
在“拍摄照片”按钮中,我正在运行以下代码:
function takePicture()
{
navigator.camera.getPicture(displayPictureURI, showError, {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI
});
}
function displayPictureURI(imageURI)
{
var imagePanel = document.getElementById('imagePanel').style.display = "";
document.getElementById("image").src = imageURI;
}
function showError(fail)
{
alert(fail);
}
The camera opens, I take a picture, and the app re-opens, but the picture is never displayed. 相机打开,我拍照,然后重新打开该应用程序,但从不显示照片。 In the log I get the following error: "Not allowed to load local resource: file:///mnt/sdcard/Android/data/org.apache.cordova.example/cache/1359468575251.jpg at :0"
在日志中,我收到以下错误:“不允许加载本地资源:file:///mnt/sdcard/Android/data/org.apache.cordova.example/cache/1359468575251.jpg在:0”
I'm not sure what I am doing wrong here. 我不确定我在做什么错。 I have the "WRITE_EXTERNAL_STORAGE" permission setup in the manifest.
我在清单中设置了“ WRITE_EXTERNAL_STORAGE”权限。 Any help is appreciated.
任何帮助表示赞赏。
Isn't really a proper solution, but I have found that if I use an earlier version of Phonegap, this issue doesn't occur. 确实不是一个适当的解决方案,但是我发现如果使用早期版本的Phonegap,就不会发生此问题。 It seems 1.7.0 works.
看来1.7.0可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.