TAILIEUCHUNG - Lập trình iPhone part 11

Cho đến nay, chúng tai đã tập trung vào việc điều khiển và xem các khía cạnh của mô hình Model-View-Controller. Mặc dù một số ứng dụng của chúng tai đã lưu dữ liệu của họ với bất kỳ hình thức lưu trữ liên tục bị bất kỳ hình thức lưu trữ non-volatile rằng tồn tại một khởi động lại của máy tính hoặc thiết bị | Cha .H Basic Data Persistence . . o far we ve focused on the controller and view aspects of the Model-ViewController paradigm. Although several of our applications have read data out of the application bundle none of our applications have saved their data to any form of persistent storage persistent storage being any form of nonvolatile storage that survives a restart of the computer or device. So far every sample application either did not store data or used volatile or nonpersistent storage. Every time one of our sample applications launched it appeared with exactly the same data it had the first time you launched it. This approach has worked for us up to this point. But in the real world your application needs to persist data so that when users make changes those changes are stored and are there when they launch the program again. A number of different mechanisms are available for persisting data on the iPhone. If you ve programmed in Cocoa for Mac OS X you ve likely used some or all of these techniques. In this chapter we re going to look at three different mechanisms for persisting data to the iPhone s file system. We re going to look at using property lists object archives or archiving and the iPhone s embedded relational database called SQLite3. We will write example applications that use all three. 329 330 CHAPTER 11 Basic Data Persistence NOTE_ Property lists object archives and SQLite3 are not the only ways you can persist data on an iPhone. They are just the three most common and easiest. You always have the option of using traditional C I O calls like fopen to read and write data. You can also use Cocoa s low-level file management tools. In almost every case doing so will result in a lot more coding effort and is rarely necessary but those tools are there if you need them. Your Application s Sandbox All three of this chapter s data-persistence mechanisms share an important .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.