开发者

Core Data only migrate specific tables [duplicate]

This question already has answers here: Example or explanation of Core Data Migration with multiple passes? (3 answers) Closed 3 years ago. 开发者_如何学JAVA

I have an iPhone app that uses a Core Data database consisting of user data, and app data. I want to update the app data by pushing an update in the app store, but I want to keep the existing user data from the user's current database. Is there any way to "pick and choose" which tables I want to migrate?


There are two things you can migrate / update:

  1. The model, i.e. the structure of your entities and properties.
  2. New data that is contained in the model.

As for the migration, you specify which tables are altered and which are not. Where possible, all the data will be preserved automatically. Check out the core data docs about migration, it's pretty straightforward.

As for the data, you can read that in from the app delegate of your new app. Check if the new data is not available (or check if this is the first run after the update), is so, update the table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜