简体   繁体   English

如何有效地为IOS应用程序创建Sqlite数据库?

[英]How to Create Sqlite database for IOS Application in efficient way?

I have built an android app and now its time to built an IOS app. 我已经构建了一个android应用,现在是时候构建一个IOS应用了。 I am very new to IOS App development. 我对IOS App开发非常陌生。 I managed to done all the UI design parts and i am coding the backend part. 我设法完成了所有UI设计部分,并且正在编写后端部分。 In my application i am using Sqlite database and has many View Controllers each View talks to database. 在我的应用程序中,我正在使用Sqlite数据库,并且每个视图都与数据库有很多View控制器。 So i would like to have one Class(Java) which take care about the creating,inserting,deleting etc. If i need to get data from database then i have to call that class to access the database. 所以我想拥有一个Class(Java),负责创建,插入,删除等操作。如果我需要从数据库中获取数据,则必须调用该类来访问数据库。 Is there any way to do like this. 有什么办法可以做到这一点。

Or 要么

I would like to know how to create sqlite database in a efficient way. 我想知道如何以有效的方式创建sqlite数据库。 Because my app fully based on database. 因为我的应用程序完全基于数据库。

Thanks for your help guys. 感谢您的帮助。

There are two main ways to create a database: 创建数据库有两种主要方法:

  1. Use CoreData. 使用CoreData。 In this case you should read manuals on CoreData, it is pretty complicated. 在这种情况下,您应该阅读有关CoreData的手册,这非常复杂。 But if you plan to use iCloud in future, I recommend you to use CoreData. 但是,如果您打算将来使用iCloud,建议您使用CoreData。

  2. Create db manually and not use CoreData. 手动创建数据库,而不使用CoreData。

The most efficient way in second case is to use a database manager for SQLite. 在第二种情况下,最有效的方法是对SQLite使用数据库管理器。 For example, SQLite manager extension for Firefox . 例如, 用于Firefox的SQLite Manager扩展

There are more programs for this, but this is free one, that I use myself. 有更多用于此的程序,但这是免费的,我自己使用。

To work with database use FMDB wrapper over SQLite . 要使用数据库, 请在SQLite上使用FMDB包装器

Nice tutorial for second approach. 第二种方法不错的教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM