我使用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