我正在使用PhoneGap(现在是Apache Cordova,版本为2.0)的应用程序,并使用PhoneGap File API来编写文件.
我使用的File API可以在以下网址引用:http: //docs.phonegap.com/en/2.0.0/cordova_file_file.md.html#File
我从这里使用Ripple Emulator(0.9.9beta):https://developer.blackberry.com/html5/download来测试我在chrome中的应用程序.
但我发现Ripple无法正确处理PhoneGap File API.
例如:
我想在PERSISTENT目录中创建一个文件(root/foo.json)
function onSuccess(fileSystem) {
fileSystem.root.getDirectory("dir", {create: true}, function(dirEntry){
dirEntry.getFile("foo.json", {create: true}, function(fileEntry){
fileEntry.createWriter(function(writer){
writer.write(JSON.stringify(fooData));
}, onfail);
}, onfail);
}, onfail);
}
function onfail(error)
{
console.log(error.code);
}
// request the persistent file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onfail);
Run Code Online (Sandbox Code Playgroud)
它在iOS模拟器上工作正常,它确实在正确的位置创建了正确的文件,但是在chrome中运行的Ripple Emulator中,我只得到一个onfail回调,并得到错误代码10(FileError.QUOTA_EXCEEDED_ERR).
我也在这里找到了一个类似问题的人:它是否能够在模拟器外测试phonegap应用程序?
但仍然没有答案.
Ripple仿真器目前无法正常用于PhoneGap API吗?或者我错过了一些设置?