简体   繁体   English

应用更新中Core Data中保存的数据会发生什么变化

[英]What happens to saved data in Core Data on app update


the headline just about sums up my question: What happens to previously saved data in Core Data when I ship a new version of my app? 标题恰好总结了我的问题:当我发布新版本的应用程序时,以前保存在Core Data中的数据会怎样?
From what I understand, migration only matters for changes in the data model - still I want to be sure before I start building... Would be pretty awkward, if all the data was gone once the customer loads the shiny new version, wouldn't it? 根据我的理解,迁移只对数据模型的变化很重要 - 在开始构建之前我仍然需要确定...如果客户加载闪亮的新版本后所有数据都消失了,那就太尴尬了。是吗?
Just to be sure... 只是要确定...
Please forgive my ignorance; 请原谅我的无知; I couldn't find anything in the docs or the web. 我在文档或网络上找不到任何内容。

All data is keet as it is, assuming you do not change the bundle name / Application Identifier. 假设您没有更改包名称/应用程序标识符,所有数据都按照原样保存。

You can see it on the simulator as it keeps the data just like on the device itself. 您可以在模拟器上看到它,因为它可以像设备本身一样保存数据。

If you use a persistent SQLite store, the new app reload data from the sqlite file. 如果您使用持久性SQLite存储,则新应用程序将从sqlite文件重新加载数据。 You have a persistent SQLite store if you wrote a line like this 如果您这样编写一行,则您将拥有一个持久的SQLite存储

NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"YourProject.sqlite"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM