开发者

iPhone and SQLite introductory articles or tutorials [duplicate]

This question already has answers here: Add an SQLite database to an iPhone app 开发者_开发百科 (7 answers) Closed 9 years ago.

What resources are great to provide information on using SQLite for beginner iPhone developers?

  • Where to download the SQLite software for the iPhone?
  • Are there multiple versions, and do they have substantial differences?
  • Where can I find some introductory tutorials?

I'm working on an iPhone project where the instructions are to store PLISTs into SQLite. My PLIST would be a read/write file. Is this possible?

As of now my PLISTs are read-only, so it very important to make it a read/write PLIST. The only method my lecturer suggested is storing it in SQLite, where reading/writing would be done there.

Please, any suggestions on intros for SQLite for the iPhone?


The homepage for SQLite is http://www.sqlite.org/. This contains lots of documentation and resources, including tutorials and links to other related information.

The software itself is already installed on all Macs and iPhones, so you don't need to download it. The command-line utility can be run as sqlite3 on the Mac, and this gives you an interactive session where you can run SQL commands. (See the docs above for full details.)

It does not really make sense to store a plist in a SQLite database (even though it is technically possible). They are used for different things. A plist file is usually used for storing settings and preferences, while an SQLite file (it is self-contained) is used for actual data, or as (opaque) persistence as used by CoreData. The plist file should be read/write anyway, but you should be using the system APIs to manage access so this wouldn't be an issue.

The resources at http://developer.apple.com/ are comprehensive. It sounds like you have a lot of reading to do! Study the docs and sample code, read a few tutorials on the web (there are loads), and experiment with writing your own little test apps to explore techniques. Have fun!


There are four parts in this tutorial. Follow the steps explained here. The authors at icodeblog has made it super simple.

http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/

Many thanks to icodeblog.com


It sounds like your prof is giving you an artificial task designed to exercise your knowledge of two different types of persistence. If his design requirements mandate that you (1) read a plist (2) then store the resulting data in sqlite, then go with gavinb's advice.

However, if he just gave you a generic task to store data in sqlite, you can use Core Data to accomplish the same task without having to learn SQL.

The parameters you gave don't sound like a the way a real world app would handle data.

Plist is a format designed to archive objects based on NSFoundation primitive classes and collections i.e. NSString, NSNumber, NSArray, NSDictionary etc. It's almost always used for app preferences/resources of some sort.

SQLite and Core Data are used to store large amounts of user data. SQLite is preferred when you have large but simple data graphs e.g. 50,000 people records with simple text fields and no relationships. Core Data is preferred when you have very complex object graphs e.g. a model for the personnel of a company with myriad relationships between individuals, other individuals and departments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜