为什么要为我的iPhone应用程序使用Core Data? [英] Why should I use Core Data for my iPhone app?

查看:78
本文介绍了为什么要为我的iPhone应用程序使用Core Data?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理我的第二个iPhone应用程序,并对核心数据很好奇。项目的时间有限,我的整体时间。



我是唯一的开发者,我有一种感觉Core Data将是有用的,但我不能清楚解释为什么。



请原谅以下模糊处理..应用程序需要从中央服务器检索foos列表。然后,用户可以从bar列表中将bar添加到foos,然后从bazes(!?)列表中将baz添加到bar,然后向baz添加一些可选的照片和描述。



一旦用户对他们的酒吧和baz工作感到满意,他们就会点击同步按钮将他们的数据上传到中央服务器。



正如你所看到的,它是一个简单的数据驱动下钻应用程序,但我仍然不能确定我可以证明使用核心数据与我们的时间约束 - 学习曲线看起来陡峭。



如果向我的老板说我们应该使用Core Data,我可以在他身上拍摄什么项目符号?核心数据将主要帮助应用程序的辅助方面 - 例如数据持久性,呈现方式(如数据持久性)




  • Core Data为您管理保存和撤消功能。它有一个持久存储,跟踪更改,并可以自动刷新到磁盘任何次数(应用程序关闭等)。

  • 核心数据和相关类提供了将实体导入UITableView的简单方法,例如NSFetchedResultsController。

  • 核心数据抽象出很多凌乱的东西你将不得不处理自己,例如对象列表,一对多或多对多关系或对对象属性的约束,变成一个非常干净的面向对象的接口。

  • Core Data附带了一个漂亮的图形对象模型编辑器,可以帮助您思考您的对象/实体设计,并在您走时对其进行优化。 (它还支持迁移,因此如果您稍后决定要在实体上使用不同的属性,则可以相对容易地做到。)



当然,学习曲线可能有点陡峭,但是苹果的例子很好,Core Data文档是非常完整和有用的。一旦你有核心数据下来,它将是一个微风,建立你的应用程序。


I'm working on my 2nd iPhone app and am curious about Core Data. Time on the project is limited, as is my time overall.

I'm the only dev and I have a feeling that Core Data would be useful but I can't clearly explain why.

Please excuse the following obfuscation .. the app needs to retrieve a list of foos from a central server. Users can then add a bar, from a list of bars, to the foos, then add a baz from a list of bazes(!?) to the bar, then add some optional photo and description to the baz.

Once the user is happy with their bar and baz work they then hit a sync button to upload their data back to the central server.

As you can see, it's a simple data driven drill down app, but I'm still not sure I can justify using Core Data with our time constraints - the learning curve looks steep.

If argue to my boss that we should be using Core Data, what bullet points can I shoot at him? Logic grenades are also appreciated.

解决方案

Core Data will mainly help in the auxiliary facets of the application - things like data persistence, presentation, etc. Some bullet points for your boss:

  • Core Data manages save and undo functionality for you. It has a persistent store, which tracks changes, and can be flushed to the disk automatically at any number of times (app close, etc.).
  • Core Data and related classes provide easy ways to get your entities into UITableViews, like NSFetchedResultsController.
  • Core Data abstracts away a lot of the messy things you'd otherwise have to deal with yourself, such as lists of objects, one-to-many or many-to-many relationships, or constraints on object attributes, into a single nice clean object-oriented interface.
  • Core Data comes with a nice graphical object model editor that can help you think through your object/entity design, and refine it as you go. (It also supports migration, so if you decide later that you want different attributes on your entities, you can do that relatively easily.)

Sure, the learning curve may be a bit steep, but the Apple examples are great to start with, and the Core Data documentation is very complete and helpful. Once you've got Core Data down, it'll be a breeze to build your app.

这篇关于为什么要为我的iPhone应用程序使用Core Data?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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