4

我在 phonegap 2.6.0 中使用了这个代码并且它工作了,现在我升级到 phonegap 3.0.0 和 xcode 5,我得到了这个错误:

onDeviceReady: =>
    try
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, failFS)
    catch e
        alert(e)


**ReferenceError: LocalFileSystem is not defined** 

我在 Chrome 中遇到了同样的错误,我猜这是正常的吗?

从 2.6 到 3 的文档仍然相同,所以我不确定发生了什么!

4

3 回答 3

2

我解决了将cordova.js文件添加到平台/ios/www/的问题

于 2014-04-08T09:18:35.700 回答
1

您应该使用以下方法将文件插件添加到您的应用程序:

phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git

您可能想检查一下: http ://docs.phonegap.com/en/edge/cordova_file_file.md.html#File

于 2013-10-01T11:21:22.507 回答
0
window.requestFileSystem  = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
function gotFS(fileSystem) {
    console.log("got filesystem"); 
    console.log(fileSystem.root.fullPath);   
}
function fail() {
   console.log("failed to get filesystem");
}
于 2013-10-01T12:19:59.910 回答