简体   繁体   English

更新新的iOS应用程序时如何保留旧数据?

[英]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.

相关问题 iOS - 在更新到新版本时保留旧的sqlite数据库 - iOS - Keep the old sqlite database while updating to new version iOS:将旧应用程序更新为Retina图形(TweeJump) - iOS: Updating old application to Retina graphics (TweeJump) 更新iOS应用程序数据 - Updating iOS application data iOS如何从商店更新数据后保留应用程序的数据 - ios how to keep data for application after update it from the store Mail iOS应用程序如何在未运行时提醒新邮件 - How can the Mail iOS application alerting for new mail while it is NOT running 更新旧对象时,核心数据会创建一个新对象 - Core Data Creates A New Object When Updating An Old One IOS tableview在下载新图像时重复使用旧图像问题 - IOS tableview reusing old images while downloading new images issue iOS-在新的应用程序版本中更新数据结构 - iOS — updating data structures in new app version 如何生成APN证书,以便在ios应用程序转移后处理APN证书以支持新旧应用程序 - How to generate APN certificate so that it should handle to support both old as well as new application after ios app transfer iOS-如何保持应用程序在后台运行 - iOS - How to keep application running in background
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM