Cordova/Phonegap移动到未获取根目录
这是一个正在调用的onSuccess函数,但是Cordova/Phonegap移动到未获取根目录,cordova,phonegap-plugins,phonegap-build,cordova-plugins,Cordova,Phonegap Plugins,Phonegap Build,Cordova Plugins,这是一个正在调用的onSuccess函数,但是moveTo方法没有提供所需的效果。它会将我的图像移动到file:///storage/sdcard0/PhotoscanPhotos/ 但是调试警报只显示//PhotoscanPhotos function movePhoto(fileEntry) { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { //o
moveTo
方法没有提供所需的效果。它会将我的图像移动到file:///storage/sdcard0/PhotoscanPhotos/ 但是调试警报只显示//PhotoscanPhotos
function movePhoto(fileEntry) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSys) { //onsuccess
fileSys.root.getDirectory("PhotoscanPhotos", {create: true, exclusive: false}, function(dir) {
var guid = guidGenerator();
Speicher.setPhotoFolder(dir.fullPath);
alert(dir.fullPath); //debugging
fileEntry.moveTo(dir, (guid + "foto.jpg"), onMoveSuccess, onFail);
}, onFail);
}, onFail);
}
有人知道我做错了什么吗?它是Phonegap 3.1 API文档的虚拟副本。我的配置文件肯定是正确的
提前谢谢
编辑:代码的其余部分以确保完整性:
function takePicture() {
var code = $("#txtCode").val();
if(!code){
alert("Zuerst EAN-Code scannen oder eingeben.");
return false;
}else{
ean = code;
}
navigator.camera.getPicture(onPhotoURISuccess, onFail,
{ quality: 100, destinationType: Camera.DestinationType.FILE_URI });
return true;
}
function onPhotoURISuccess(imageURI) {
createFileEntry(imageURI);
showImageList();
}
function createFileEntry(imageURI) {
window.resolveLocalFileSystemURI(imageURI, movePhoto, onFail);
}
function movePhoto(fileEntry) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSys) { //onsuccess
fileSys.root.getDirectory("PhotoscanPhotos", {create: true, exclusive: false}, function(dir) {
var guid = guidGenerator();
Speicher.setPhotoFolder(dir.fullPath);
alert(dir.fullPath); //debugging
fileEntry.moveTo(dir, (guid + "foto.jpg"), onMoveSuccess, onFail);
}, onFail);
}, onFail);
}
function onMoveSuccess(entry) {
var image = {ean:ean, image: entry.fullPath, timestamp:convertDateToUTC()};
alert(image.image); //debugging
getPhotoFolder();
alert(numOfPhotosStored + " photos stored"); //debugging
images.push(image);
Speicher.setImages(images);
showImageList();
}
function onFail(error) {
alert(error.code + error.message);
}
无论如何,Phonegap在14小时前更新了
fileTransfer
方法
我生命中的两个小时再也回不来了。我昨天忘了说这很好用,我花了最后两个小时检查版本是否有差异,但没有发现任何差异,于是我大发雷霆