我应该保存在 plist 还是 Core Data 中? [英] Should I save in plist or Core Data?

查看:16
本文介绍了我应该保存在 plist 还是 Core Data 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否应该将应用程序中的数据保存到 plist 或使用 Core Data..

I'm wondering if I should save data in my app to a plist or using Core Data..

我的应用现在基本上只是保存来自时间线和其他用户的推文.这不到几百 kB(在我的测试中约为 200 kb).使用核心数据有什么好处?

My app is just basically saving tweets from timeline and other users now. Which is less than a few hunderd kB (about 200 kb in my testing). What's the advantages of using core data?

推荐答案

除了保存简单的首选项和真正基本的数据结构之外,我不会考虑使用 plist.此外,在性能方面,检索数据并将其保存到 plist 可能会很慢.

I would not consider plists for anything other than saving simple preferences and really basic data structure. Plus performance wise, retrieving and saving data to plists can be quite slow.

在与 Coredata 斗争了很长时间之后,现在我终于得到了它,我会选择它而不是任何一天.是的,它确实有一些陡峭的学习曲线,但你可以免费"获得很多东西,我肯定会花时间学习和探索它.

After struggling with Coredata for a long time, now that I finally get it I would choose it over anything any day. Yes it does have a bit of a steep learning curve but there is so much you get "for free" with it, I'd definitely invest the time to learn and explore it.

Coredata 将使您可以根据需要灵活地扩展对象模型,根据某些参数轻松地从持久存储中获取对象,在模型、内存管理和列表之间创建关系.

Coredata will give you flexibility to expand your object models as needed, easily fetch objects from the persistant storage based on certain parameters, create relationships between models, memory management and the list goes on.

Apple 对 Coredata 进行了很好的记录,因此您将找到入门所需的一切以及更多内容.有示例、示例项目、视频,应有尽有 - 所以如果您对性能、可扩展性和一些乐趣也感兴趣,我绝对建议您看看 :)

Coredata is really well documented by Apple so you will find everything you need to get started plus more. There are examples, sample projects, videos, you name it - so I'd definitly recommend you have a look IF you are interested in performance, scalability and having a bit of fun too :)

这篇关于我应该保存在 plist 还是 Core Data 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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