删除核心数据版本xcdatamodel文件 [英] Deleting core data version xcdatamodel files
问题描述
我在我的iOS应用程序中创建了一个版本化的Core Data模型,并且它已经创建了多个版本(在.xcdatamodeld包中有多个.xdatamodel文件)。在发布应用程式之前,我正在考虑删除这些旧版本,因此我可以从一个干净的数据模型开始 - 在这个阶段,数据丢失不是一个问题。
I've created a versioned Core Data model in my iOS app, and it has several versions created so far (several .xdatamodel files within the .xcdatamodeld bundle). Before shipping the app, I'm considering deleting these old versions so I can start with a single clean data model - and data loss isn't an issue at this stage.
这是可能吗?
推荐答案
删除所有Core数据文件并重新创建新模型,旧模型意味着您无法迁移任何现有的数据存储。我假设你确定与给你的数据丢失的声明。如果您想要重新启动,可以使用当前xcdatamodel,将其复制到其他位置(例如您的桌面),然后删除xcdatamodeld文件夹。此时,您可以将已保存的xcdatamodel拖回Xcode并将其重新添加为非版本文件。
Deleting the old models means you cannot migrate any existing data stores. I assume you're ok with that given your statement about data loss. If you want to start fresh, you can take the current xcdatamodel, copy it somewhere else (e.g. your Desktop), then delete the xcdatamodeld folder. At this point, you can drag your saved xcdatamodel back into Xcode and re-add it as a non-versioned file.
这篇关于删除核心数据版本xcdatamodel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!