我使用phonegap/cordova(3.3.0)来访问iOS摄像头功能。 相机的来源设置为图书馆,以获取图书馆的条目。 如果我从库中选择一个文件,我收到uri,我想用它来复制文件。phonegap从iOS照片库复制图片
navigator.camera.getPicture(capSucc, capFail,{
sourceType: Camera.PictureSourceType.PHOTOLIBRARY
});
function capSucc(fileURI){
cpyCtrl.copy(fileURI);
}
然后我尝试从fileURI从localFileSystem获取文件。我收到一个FileEntry的,但它停在该文件的复制指令:
window.resolveLocalFileSystemURI(sourceFile, onSuccess, onError);
function onSuccess(fileEntry) {
var root = localStorage.rootPath; //root : /Users/xcode/Library/Application Support/iPhone Simulator/6.0/Applications/2102E3A0-7F22-4C56-A693-EF3CF2A7620F/Documents/
var parentName = root.substring(root.lastIndexOf('/')+1);
var parentEntry = new DirectoryEntry(parentName,root);
fileEntry.copy(parentEntry, "myPic.jpg", succ, fail); //this is where the problem occurs
}
function succ(entry){
alert("copy");
}
function fail(message){
alert("fail");
}
function onError(message){
alert("fileFail");
}
}
该文件的目的应该是文件系统的ROOTPATH。
嗨@marcel您可以请张贴您的插件首选项版本。我仍然无法做到这一点。我需要你的帮助。感谢致敬 – BizApps