8

我必须在 iPhone 上存储大量数据,然后根据需要对其进行排序和搜索。任何人都可以向我建议我应该使用哪个 SQLite 或 plist 吗?

我正在考虑使用 SQLite。plist 和 SQLite 中哪个在搜索和排序中花费更少的处理时间?

如果有人有一些参考指南,请告诉我。

问候

4

2 回答 2

10

Plist and SQLite have different use cases.

PList is a file format used to store a small amount of structural data (less than a few hundred kilobytes), typically a dictionary. PList doesn't have sorting capabilities in and of itself, although code can easily be written to sort it.

SQLite is a full-fledged database. File sizes (on an iphone) are essentially unlimited. Sorting capabilities are built in. Querying and relational table designs are possible. Performance should be as good as any sorting algorithm you might come up with.

于 2009-07-07T04:55:43.193 回答
3

I have not compared the performance of plist vs sqlite, but if you are storing "huge data" as you say then you will benefit from sqlite. Especially if you are going to be performing complex queries, extraction, searching and sorting etc..

From your breif description I would recommend SQLite, but I can't answer your question regarding performance.

Regarding an example on who to use SQLite on the iphone. Apple has a sample on how to do it here

于 2009-07-07T04:54:41.447 回答