核心数据与 SQLitePersistentObjects
我正在创建一个 iPhone 应用程序,并尝试在 2 个持久存储解决方案之间进行选择。
核心数据,或 SQLitePersistentObjects。基本上,我的应用程序需要的只是一种存储模型对象数组,然后再次加载它们以在 UITableView 中显示的方法。没什么太复杂的。 Core Data 似乎比简单使用的 SQLitePersistentObjects 具有更高的学习曲线。在我的例子中,使用 Core Data 相对于 SQLitePersistentObjects 有什么明显的好处吗?
I'm creating an iPhone app and I'm trying to choose between 2 solutions for a persistent store.
Core Data, or SQLitePersistentObjects. Basically, all my app needs is a way to store an array of model objects and then load them again to display in a UITableView. Its nothing too complicated. Core Data seems to have a much higher learning curve than the simple to use SQLitePersistentObjects. Are there any obvious benefits of using Core Data over SQLitePersistentObjects in my case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
作为 SQLite Persistent Objects 的作者,我说:使用 Core Data。
当手机上不存在 Core Data 时,我编写了 SQLPO。尽管我对 SQLPO 所做的事情感到自豪,并且尽管我确实比 Core Data 更喜欢它的方法的某些方面(特别是不必维护单独的类文件和数据模型),但 Core Data 底层的引擎更加成熟并且投入了更多的工程时间。这就是为什么当 Core Data 出现在 iPhone SDK 中时我放弃了 SQLPO 开发。
我还没有做过基准测试,但我猜想如果使用得当,核心数据在几乎所有大容量情况下都会表现得更好。
SQLPO 的开发速度更快,因为您所做的只是创建头文件,但除非您的数据需求相对较少,否则我建议您最好使用 Core Data。
As the author of SQLite Persistent Objects, I say: use Core Data.
I wrote SQLPO when Core Data didn't exist on the phone. Although I'm proud of what I did with SQLPO and even though I do like some things about its approach better than Core Data's (specifically not having to maintain separate class files and data model), the engine underlying Core Data is much more mature and has many more engineering hours invested in it. That's why I abandoned SQLPO development when Core Data came to the iPhone SDK.
I haven't done benchmarks, but I would guess that used correctly, Core Data is going to perform better in nearly all high-volume situations.
SQLPO is faster to develop with since all you do is create the header files, but unless your data needs are relatively light, I say you'd be better off using Core Data.
看到这个问题。我对这个问题的回答也适用于你的。
核心数据 VS SQL 语句, iphone开发的gd是哪一个?
See this question. My answer to that question also applies to yours.
Core Data VS SQL Statement, which one is gd for iphone development?
关于我使用 SQLitePersistentObjects 的经验的一些信息。
最初使用 SQLPO 为 iOS 3.x 开发的应用程序运行得很好。使用方便等。
现在我正在将这个应用程序引入 iOS 4,但事情开始变得奇怪。
我现在看到数据库损坏的速度不可预测。
查看SQLPO代码发现只有一个sqlite3_close语句,当数据库无法打开时会调用该语句。
我计划添加一个方法来显式关闭数据库,并从我的应用程序委托终止和 iOS4 didMovetoBackground 方法中调用此方法。
可能有助于避免 SQLPO 的数据库损坏问题。
Some infromation on my experience with SQLitePersistentObjects.
An app initially developed for iOS 3.x utilizing SQLPO works just fine. Easy to use etc.
Now I am in the process of bringing this app to iOS 4 and things started to get strange.
I now see DB corruptions at unpredictable rates.
Looking into the SQLPO code shows that there is only one sqlite3_close statement and this is called when the DB can not be opened.
I am planning to add a method to close the DB explicitely and call this from my app delegates terminate and for iOS4 didMovetoBackground methods.
Might help to avoid DB corruption issues with SQLPO.
我最近不得不做出同样的决定。我正在存储一个具有几个属性的简单对象的实例。根据我的研究,我了解到使用核心数据将帮助您更好地管理具有多种关系的更复杂的对象。我最终使用 Core Data 只是因为我想了解更多关于它的信息(但对于简单的对象来说,没有太多的学习曲线)。
I recently had to make the same decision. I was storing instances of a simple object with a couple of properties. From my research I understand that using Core Data will help you better manage more complex objects with multiple relationships. I ended up using Core Data only because I wanted to learn more about it (but for simple objects there wasn't much of a learning curve).
SQLitePersistentObjects 又名 SQLLite 持久对象与直接执行 SQLite 完全不同。它本身就是一个 ORM。我还没有使用过它,但我想纠正上一个帖子给出的完全错误的答案。
我正在认真考虑使用,因为核心数据很痛苦。
请参阅:http://iphonedevelopment.blogspot.com/2008/08/ sqlite-persistent-objects.html
SQLitePersistentObjects aka SQLLite Persistent Objects is not the same as doing straight SQLite at all. It's an ORM in its own right. I haven't used it yet, but I wanted to correct the completely wrong answer that the previous poster gave.
And I'm seriously considering using because Core Data is a pain.
See: http://iphonedevelopment.blogspot.com/2008/08/sqlite-persistent-objects.html