[英]How to keep old data while updating new iOS application?
My iOS app is using NSCoreData
and stores lots of data in the database. 我的iOS应用正在使用NSCoreData
并将大量数据存储在数据库中。 I designed the database schema in *.xcdatamodeld
file in xcode. 我在xcode的*.xcdatamodeld
文件中设计了数据库模式。 I am planning to update my application soon and need to change the schema a little. 我打算尽快更新我的应用程序,并且需要稍微更改架构。 However, when I tested it, new version is removing all old data, saved in previous version. 但是,当我对其进行测试时,新版本将删除所有保存在先前版本中的旧数据。
How can I effectively migrate to new database schema without loosing old data in the app? 如何在不丢失应用程序中的旧数据的情况下有效地迁移到新的数据库架构? I tried to google for a suitable solution, but could not find any effective idea, how to do it. 我试图用谷歌搜索一个合适的解决方案,但找不到任何有效的想法,怎么做。
Use documents directory it will keep your data even if you update the app. 使用文件目录 ,即使您更新应用程序,它也会保留您的数据。
you can find out about documents directory here What is the documents directory (NSDocumentDirectory)? 您可以在此处找到有关文档目录的信息。 什么是文档目录(NSDocumentDirectory)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.