cũng giống như bạn sẽ truy cập dữ liệu có khóa từ một NSDictionary. Sự khác biệt là NSUserDefaults dữ liệu tồn tại hệ thống tập tin thay vì được lưu trữ trong một thể hiện đối tượng trong bộ nhớ. trong | 380 CHAPTER 11 Basic Data Persistence Check that checkbox and then click the Choose. button. When prompted enter a project name of Core Data Persistence. Before we move on to our code let s take a look at the project window. There s some new stuff here you ve not seen before. Expand both the Classes and Resources folders see Figure 11-6 . Figure 11-6. Our project template with the files needed for Core Data File Name A s Code A 0. a Core Data D 7 1 1 Ml 7 u y ỵ A 0 y Entities and Managed Objects Of course we have a bunch of files you re already familiar with an application delegate a and an info property list. But there s another file in the Resources folder called . That is our data model. Core Data lets us design our data models visually without writing code. Single-click that file now and you will be presented with the data model editor see Figure 11-7 . You may want to expand your Xcode window and hide the detail pane E while working with the data model editor. Download at CHAPTER 11 Basic Data Persistence 381 Figure 11-7. Core Data s data model editor. This is where you an create and edit data models. The traditional way to create data models in Cocoa is to create subclasses of NSObject and conform them to NSCoding and NSCopying so that they can be archived as we did earlier in this chapter. Core Data uses a fundamentally different approach. Instead of classes you create entities here in the data model editor and then in your code create managed objects from those entities. IIP_ The terms entity and managed object can be a little confusing since both refer to data model