如何删除 CoreData Model Version

 我来答
miniappYoh44tFFDbwZi
2016-01-29 · 请开发者输入账号签名
miniappYoh44tFFDbwZi
采纳数:14074 获赞数:18291

向TA提问 私信TA
展开全部
How to remove a Core Data Model Version

Core Data can handle several versions of your Model. It’s easy to add a version (via Editor – Add Model Version) and set it active, but it’s not so easy to remove a version you no longer need.
Thankfully there is a way to delete version files which goes a long way to declutter your brain. The secret lies in the fact that the .xcdatamodeld file is actually a Package and can contain more than one file. It’s like the .app extension which isn’t just one file. I never knew this!
To explore, select your versioned .xcdatamodeld file, right-click it and select “Show in Finder”. Once in there right-click it again and select “Show Package Contents”. Surprise – here are all your Model Versions. Before you go on a mad deleting spree, head back to Xcode and do the following:
activate a Model Version that you want to keep (by going to the top level .xcdatamodeld entry, then select it under “Versioned Core Data Model”)
next remove the entire file from your project (just the reference… do not move to trash)
head back to the Finder and delete the files inside the Package you no longer want
go back to Xcode and add the .xcdatamodeld file again
Voila – now all your unnecessary Model Versions are gone. Perhaps in a future version of Xcode there will be an easier way to do this, but as of Xcode 4.6.2 (April 2013) there is not.
Further Reading

Thanks to David Avendasora for this wonderfully simple explanation on Stack
HZYSCHUNC
2016-01-29
知道答主
回答量:16
采纳率:0%
帮助的人:3.7万
展开全部
不建议删除,这是核心数据模型,相当与核心数据的备份。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式