Phát triển ứng dụng cho iPhone và iPad - part 28

Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 28', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Model Versioning and Schema Migration 239 NSStoreModelVersionHashesVersion 3 NSStoreModelVersionldentifiers NSStoreType SQLite NSStoreUUID 6B5E801A-9B00-4F17-858D-726679EE28C3 reason The model used to open the store is incompatible with the one used to create the store You ll fix this error in the next section. Lightweight Migration In order to make your existing data work with your new data model you need to migrate the schema to a new data store. If the changes that you have made are not too drastic you can easily accomplish this using a process called lightweight migration. Lightweight migration is a feature of Core Data that helps you to automatically migrate a data store from one model version to another. In the previous section I briefly mentioned the mapping model. Core Data uses the mapping model to determine how to map data from one schema model into another. Lightweight migration allows Core Data to infer the mapping model based on the changes that you made to the model from one version to another. Lightweight migration is particularly handy during development because you won t have to regenerate your test data every time you make a change to your model. It is also fast to implement because you don t have to go through the trouble of creating your own mapping model to map your data from one version to another. For lightweight migration to work the changes to your model have to be simple. Generally if you add an attribute make a required attribute optional or make an optional attribute required and add a default value lightweight migration will work for you. If you change the name of an entity or attribute you need to set the renaming identifier for the renamed attribute in the user info pane to the old name of the attribute in the source model. In the Tasks example the model has changed but you are still trying to use a data store that works with the old model. In this instance you can use lightweight migration because you have only added a new field to .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
272    19    1    23-11-2024
Đã 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.