Use sqlite database for iOS (robovm) with libgdx(使用带有 libgdx 的 iOS 的 sqlite 数据库(robovm))
问题描述
我有一个 libgdx 项目 (Android),我在其中使用 sqlite 数据库.我正在 iOS 版本 (robovm) 中开发相同的项目,但我找不到任何关于 iOS 版本的 sqlite 或数据库的信息.
I have a libgdx project (Android) where I use a sqlite database. I'm developing the same project in iOS version (robovm) and I can't find anything about sqlite or database for iOS version.
是否可以使用同一个sqlite数据库?
Is it possible to use the same sqlite database ?
谢谢.
推荐答案
我知道这是一个旧线程,但这对我有用
I know this is an old thread but this worked for me
当然,你不必完全这样做,但我就是这样做的
You dont have to do it EXACTLY like this of course, but this is how i did it
首先我为 SQLite 创建了一个辅助类,名为.. SQLiteHelper这将初始化事物
First i made a helper class for SQLite called.. SQLiteHelper This would initialize things
然后每个数据库扩展这个类例如,我有一个消息数据库
Then each database extends this class For example, i have a database of Messages
我创建了一个 SQLiteMessages 类,它扩展了我创建的 Helper 类
I make a SQLiteMessages class which extends my Helper class i made
然后在构造函数中创建表格
Then in the constructor i make the table
那么当我可以在 SQL 中正常添加、删除和更新时
Then when i can add and delete and update as normal in SQL
显然您需要有一个 Message 对象,但这与问题无关
Obviously you need to have a Message object but thats not really related to question
简单地检索数据:
不需要任何外部库请记住将其添加到您的 robovm.xml
No external libraries are needed for this Remember to add this to your robovm.xml
这篇关于使用带有 libgdx 的 iOS 的 sqlite 数据库(robovm)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!