Introduction導言
Core Data is a schema-driven object graph management and persistence framework. Fundamentally, Core Data helps you to save model objects (in the sense of the model-view-controller design pattern) to a file and get them back again. This is similar to
archiving (see Archives and Serializations
Programming Guide), but Core Data offers much more than that. Amongst other things, it:
Core Data是一個模型驅動的對象關係圖管理和持久儲存架構。從根本上說,Core
Data有助於你將模型對象(模型 - 視圖 - 控制器設計模式意義上的)儲存到一個檔案中,以及將他們取回來。這類似于歸檔(參看歸檔和序列化編程指南),但Core
Data提供的更多。除此以外,它還提供:
Provides an infrastructure for managing all the changes to your model objects. This gives you automatic support for undo and redo, and for maintaining reciprocal relationships between objects.
提供一個基礎架構,用於管理你的模型對象的所有更改。這使您的app自動支援撤消和重做,並能維護對象之間的相互關係。
Allows you to keep just a subset of your model objects in memory at any given time. This is especially important on iOS where conserving memory is critical.
- 允許在任何時刻只在記憶體中儲存一份模型對象們的子集。這對於IOS這種節約記憶體很關鍵的系統尤其重要。
Uses a schema to describe the model objects. You define the principal features of your model classes—including the relationships between them—in a GUI-based editor. This provides a wealth
of basic functionality “for free,” including setting of default values and attribute value validation.
- 用一個模型來描述模型對象。在一個基於GUI的編輯器中,你可以定義模型淚的主要特性——包括它們之間的關係。這提供了豐富的免費功能,包括預設值的設定和屬性值驗證。
Allows you to maintain disjoint sets of edits of your objects. This is useful if you want to, for example, allow the user to make edits in one view that may be discarded without affecting
data displayed in another view.
- 允許你保持編輯對象的不相交集合。例如。如果你想讓使用者在一個視圖裡實施編輯操作,而在另一個視圖中為了不影響資料的展示又要捨棄第一個視圖中的更改,這個功能就會非常有用了。
Has an infrastructure for data store versioning and migration. This lets you easily upgrade an old version of the user’s file to the current version.
- 對於資料存放區的版本和遷移有基礎支援。這可以令你輕鬆地將使用者檔案從舊版本升級為新版本。
Core Data is available on iOS 3.0 and later.
Core Data只在ios3.0及之後的版本中提供。
You should read this document to learn how to use Core Data on iOS, including:
在IOS中,你應該閱讀本文檔來學習如何使用Core Data。包括:
The fundamental design patterns and techniques that underlie Core Data
基本的設計模式和技術,這些是 Core Data的基礎
The basics of using the Xcode data modeling tool
- 使用Xcode資料建模工具的基礎
- How to create, update, and delete objects managed by Core Data, and how to commit changes to a data store
- 如何建立、更新和刪除由Core Data管理著的對象,以及如何提交改變到資料存放區中
Important: Core Data is not an entry-level technology. Before starting to use Core Data, you must understand the basics of iOS application development, including:
重要提示:Core Data不是一個入門級的技術。在開始使用Core
Data之前,你必須瞭解iOS應用程式開發的基礎知識,包括:
How to use Xcode and Interface Builder
如何使用Xcode和Interface Builder
Fundamental design patterns such as model-view-controller and delegation
基本的設計模式,如模型
- 視圖 - 控制器和代理
How to use view controllers, navigation controllers, and table views
如何使用視圖控制器,導航控制器和表視圖
None of these tools and techniques are explained in this tutorial, so that the content can focus on Core Data itself.為了讓內容關注Core
Data本身,本教程不會解釋說明這些工具和技術。
Documents you should read to gain adequate experience include:
你應該閱讀下列文檔,以獲得足夠的經驗:
Organization
of This Document
This tutorial comprises the following chapters:本教程包括以下章節:
The source code for the tutorial is provided in the Locations sample code.
本教程的原始碼由Locations範例程式碼提供。