-1

I'm doing a mobile app using the Phonegap 2.9.0 compiling through the Phonegap Build.

I did some tests with geolocation and worked fine. But now I'm trying to write/read files. So, i'm using the sample code provided in the Phonegap documentation.

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);

And it throws a error (FileError.NOT_FOUND_ERR) everytime. And if i try to access the fileSystem it's undefined.

In the config.xml file. I request for the File plugin.

<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/storage"/>
<feature name="http://api.phonegap.com/1.0/file"/>

I searched a lot, in another questions, and any helped me.

Thanks for helping.

4

1 回答 1

0

你确定你<script type="text/javascript" src="phonegap.js"></script>在你的头标签中引用了?

您确定您正在等待通过使用document.addEventListener("deviceready", onDeviceReady, false);而不是尝试调用文件 API 来调用 deviceready,直到引用回调?

我知道使用 Phonegap Build 3.0,您需要将其包含<gap:plugin name="org.apache.cordova.core.file" />在您的 config.xml 中,但这仅适用于 3.0。我不知道 2.x 是否还有其他需要

如果可以的话,你真的应该去 Phonegap Build 3.0。

于 2013-10-16T19:40:03.300 回答