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

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

问题描述

我正在开发我的第二个 iPhone 应用程序并且对 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.

我是唯一的开发人员,我觉得 Core Data 会很有用,但我无法清楚地解释原因.

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

请原谅以下混淆.. 应用程序需要从中央服务器检索 foos 列表.然后用户可以从酒吧列表中添加一个酒吧到 foos,然后从一个酒吧列表中添加一个巴兹(!?)到酒吧,然后向巴兹添加一些可选的照片和描述.

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.

一旦用户对他们的 bar 和 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.

如您所见,这是一个简单的数据驱动的钻取应用程序,但我仍然不确定是否可以在时间限制下使用 Core Data - 学习曲线看起来很陡峭.

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.

如果向我的老板争论我们应该使用 Core Data,我可以向他射击哪些要点?逻辑手榴弹也很受欢迎.

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 将主要在应用程序的辅助方面提供帮助 - 例如数据持久性、呈现等.给你老板的一些要点:

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 为您管理保存和撤消功能.它有一个持久性存储,用于跟踪更改,并且可以在任意次数(应用程序关闭等)自动刷新到磁盘.
  • Core Data 和相关类提供了将实体放入 UITableViews 的简单方法,例如 NSFetchedResultsController.
  • Core Data 将您原本必须自己处理的许多杂乱事物(例如对象列表、一对多或多对多关系或对对象属性的约束)抽象为一个单个漂亮干净的面向对象界面.
  • Core Data 带有一个很好的图形对象模型编辑器,可以帮助您思考您的对象/实体设计,并在您进行时对其进行改进.(它还支持迁移,因此如果您稍后决定希望实体具有不同的属性,您可以相对轻松地做到这一点.)

当然,学习曲线可能有点陡峭,但 Apple 示例非常适合入门,而且 Core Data 文档非常完整且有用.一旦您掌握了 Core Data,就可以轻而易举地构建您的应用.

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天全站免登陆