Ionic 2 Cordova和Typescript(应用程序首选项插件) [英] Ionic 2 Cordova and Typescript (App Preferences plugin)

查看:85
本文介绍了Ionic 2 Cordova和Typescript(应用程序首选项插件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Typescript开发Ionic 2应用程序. 对于设置首选项,我希望使用cordova插件 https://github.com/chrisekelley/AppPreferences/.

I am working on Ionic 2 application with Typescript. For setting up preferences I wish to use the cordova plugin https://github.com/chrisekelley/AppPreferences/.

有些事情我正在苦苦挣扎.经过大量谷歌搜索后,有些事情我还无法弄清楚. 如果有人可以帮助,那就太好了.

There are a few things I am strugling with. After a lot of googling there are a few things that I am not yet able to figure out. It would be great If anyone can help.

  1. 使用上述带有Ionic 2的Cordova插件. 互联网上有几则帖子将我带到了我目前所在的位置.但是它们中的大多数都引用javascript,因此不能完全帮助您. 我不是打字机吗?如何使用和访问打字稿中的插件方法?

  1. Using the above Cordova Plugin with Ionic 2. There are a few posts on the internet which got me to where I am currently. But most of them refer to javascript so dont help completely. How do I use and access the plugin methods in typescript as this is not an ionic-native plugin?

其次,我知道将在IOS上生成一个plist文件,可以从IOS的应用程序设置"中对其进行修改,以作为更新设置的一种方法.在android上如何以及在何处具有相似的页面/功能?

Secondly, I understand on IOS a plist file will be generated which can be modified from Application Settings in IOS as a means to update settings. How and where can I have a similar page/functionality on android?

推荐答案

我建议您改用 SqlStorage 保留数据(如首选项),因为ionic直接支持该数据.如果这样做,则需要安装sqlite插件ionic plugin add cordova-sqlite-storage

I would recommend that you instead use SqlStorage to persist data like preferences, as it is directly supported by ionic. If you do so, you need to install the sqlite plugin ionic plugin add cordova-sqlite-storage

这篇关于Ionic 2 Cordova和Typescript(应用程序首选项插件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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