PhoneGap的的navigator.fileMgr总是不确定的 [英] PhoneGap's navigator.fileMgr always undefined

查看:156
本文介绍了PhoneGap的的navigator.fileMgr总是不确定的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建iOS应用与PhoneGap的,需要写入和读取文本文件到设备上。

I'm building iOS app with PhoneGap, need to write and read text file to the device.

我跟这里找到步骤:<一href=\"http://docs.phonegap.com/en/2.0.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS\" rel=\"nofollow\">http://docs.phonegap.com/en/2.0.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS

一切工作正常,但我不能使用任何的API(我试过文件和通知)。我打电话:
警报(navigator.fileMgr),但它总是不确定的。

Everything works fine, except I cannot use any of the API (I tried file and notification). I am calling: alert(navigator.fileMgr) but it's always undefined.

我打电话,在deviceready回调函数。

I am calling that in the deviceready callback function.

我想我错过了一些重要步骤,任何人都可以在这方面的经验给我一些链接/引导/帮助?

I think I missed some important steps, could anyone have experience in this give me some link/guide/help?

在此先感谢!

推荐答案

我不知道你在哪里得到你的信息,但navigator.fileMgr不存在了,也没有很长一段时间。我们已经实现了W3C文件API:

I'm not sure where you are getting your info but navigator.fileMgr does not exist anymore and hasn't for a long time. We've implemented the W3C File API:

http://docs.phonegap.com/en/ 2.0.0 / cordova_file_file.md.html#文件

要获得文件系统,你会做的根路径:

To get the root path of the file system you would do:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) {
    console.log("File system root = " + fileSys.root.fullPath);
}, function() {
    console.log("Could not get file system");
});

如何读/写文件也可在文档网站的例子。

Examples of how to read/write files are also available on the docs site.

这篇关于PhoneGap的的navigator.fileMgr总是不确定的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆