在 iOS 应用程序中处理数据(选择什么?NSData、CoreData、sqlite、PList、NSUserDefaults) [英] Working with data in iOS Apps (What to choose? NSData, CoreData, sqlite, PList, NSUserDefaults)

查看:20
本文介绍了在 iOS 应用程序中处理数据(选择什么?NSData、CoreData、sqlite、PList、NSUserDefaults)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我开发 iPhone 应用程序(时间跟踪器、ToDoList 等)时,我永远不知道处理数据的最佳方式是什么.一旦我使用 plist,下次使用 sqlite 或 CoreData.

when I develop an iPhone App (Time Tracker, ToDoList etc) I never know whats the best way to deal with the data. Once I used a plist, next time sqlite or CoreData.

您如何决定什么最适合您的项目?(只谈数据管理)

How do you decide whats the best for your project? (Only talking about data management)

例如如果你想开发:

  • 时间跟踪器应用程序 > PList 是您的选择吗?
  • RSS 阅读器应用程序 > CoreData?
  • 照片应用 > sqlite?
  • 电子邮件客户端 > ?

对于初学者,你能粗略地指出正确的方向吗?(我知道这在很大程度上取决于应用程序以及您喜欢做什么它,但任何想法都会有所帮助)

For a beginner can you point me roughly to proper directions? (I know it depends a lot on the App and what you like to do with it but any thought will help)

我远离开发复杂的应用程序,它们仍然非常简单.

I'm far away from developing complicated apps, they are still pretty simple.

感谢您的帮助,马克

推荐答案

您可以使用这些经验法则来决定哪种存储模型适用于您的应用.

You can use these rules of thumb to decide what storage model will work for your app.

  • 如果数据完全适合内存并且相对非结构化,请使用 plist
  • 如果数据完全适合内存并且具有树状结构,请使用 XML
  • 如果数据不适合内存且具有图形结构,并且应用不需要非凡的查询能力,请使用 Core Data
  • 如果数据不适合内存、结构复杂或应用受益于关系数据库提供的强大查询功能,请使用 sqlite
  • 如果数据必须保密(例如密码),请使用 钥匙串.

请注意,这些选择通常会重叠,因为多个存储模型将适合同一个应用程序.您的最终决定取决于您的个人偏好 - 您选择一种您更了解的技术.

Note that these choices often overlap, because multiple storage models will fit the same app. Your final decision depends on your personal preferences - you pick a technology that you understand better.

Stack Overflow 上有一个关于 sqlite 与核心数据的非常好的问题,您可能想要通读该问题的答案.

There was a very good question about sqlite vs. Core Data on Stack Overflow, you may want to read through the answers to that question.

这篇关于在 iOS 应用程序中处理数据(选择什么?NSData、CoreData、sqlite、PList、NSUserDefaults)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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