核心数据对readonly数据是否有用? [英] Is Core Data useful for readonly data too?

查看:107
本文介绍了核心数据对readonly数据是否有用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个iPhone应用程序,我想知道核心数据是否比只读数据比SQLite数据库更好。感觉就像SQLite DB是更好的选择,是吗?我可以预先填充Core Data存储吗?

I'm creating an iPhone App and am wondering whether Core Data is better for readonly data than a SQLite database. It feels like the SQLite DB is the better choice, is that right? Can I even pre-fill the Core Data storage?

基本上,我需要3个表,每个表有一个(最多3000个)实体。然后我想在TableView中列出数据,搜索它或为其他目的加载东西。

Basically, I need like 3 tables with a bunch (up to 3000) of entities each. I then want to list the data in TableViews, search on it or load things for other purposes.

在这种情况下应该或可以使用Core Data?

Should or can I use Core Data in this case?

推荐答案

如果您将在表视图中显示只读数据,则通过SQLite使用Core Data可能有很大的优势, NSFetchedResultsController。这个便利类使得在表视图中显示数据库元素非常容易,并且它可以为您处理批量提取。批量提取允许您只加载屏幕上所需的信息,从而大大提高除最小数据集之外的所有数据集的加载时间和内存使用情况。

If you will be displaying your read-only data in a table view, there can be significant advantages to using Core Data over SQLite simply due to NSFetchedResultsController. This convenience class makes it extremely easy to display database elements in a table view, and it can handle batched fetching for you. The batched fetching lets you load only the information you need on screen right then, dramatically improving loading time and memory usage for all but the smallest data sets.

我使用Core Data对于我出于我的应用程序的捆绑包中的只读信息,以及我可以与存储在用户的应用程序数据中的可写数据库共享数据模型的事实。我的建议是去核心数据,除非你绝对需要目标iPhone OS 2.x设备。

I use Core Data for read-only information that I ship in my application's bundle for this reason, along with the fact that I can share a data model with the writable database stored in the user's application data. My recommendation is to go with Core Data unless you absolutely need to target iPhone OS 2.x devices.

这篇关于核心数据对readonly数据是否有用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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