删除核心数据版本 xcdatamodel 文件 [英] Deleting core data version xcdatamodel files

查看:27
本文介绍了删除核心数据版本 xcdatamodel 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 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 数据文件并重新创建新模型的情况下,实现这一目标的最佳方法是什么.

Is this possible? And what would be the best way to achieve this without simply deleting all Core data files and recreating a new model.

推荐答案

删除旧模型意味着您无法迁移任何现有数据存储.鉴于您关于数据丢失的声明,我假设您对此没有意见.如果您想重新开始,您可以使用当前的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆