xcode 如何清除和重置 Core Data 数据模型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23820523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to clear and reset Core Data data models
提问by David van Dugteren
I have now >45 different versions of xcdatamodel in Xcode, of which 44 of them are no longer required, as I've eseentially gone for the drop/create approach of the entire database. How can I clear these out, without Xcode kicking up a fuss?
我现在在 Xcode 中有超过 45 个不同版本的 xcdatamodel,其中 44 个不再需要,因为我已经完全放弃了整个数据库的删除/创建方法。我怎样才能清除这些,而不用 Xcode 大惊小怪?
See the linked image:
请参阅链接的图像:
https://www.dropbox.com/s/1bpdhf9bax6iicb/Screenshot%202014-05-23%2013.24.45.png
https://www.dropbox.com/s/1bpdhf9bax6iicb/Screenshot%202014-05-23%2013.24.45.png
回答by rob5408
Note: this approach is waaaaayyyy simpler: https://stackoverflow.com/a/6712191/84783, but if you wanna get up to your elbows with project files, try my steps below.
注意:这种方法更简单:https://stackoverflow.com/a/6712191/84783 ,但如果您想处理项目文件,请尝试以下我的步骤。
I think they keep these around for current installations to do model migrations. Sadly I think you have some manual project file hacking.
我认为他们将这些保留在当前安装中以进行模型迁移。可悲的是,我认为您有一些手动项目文件黑客攻击。
- Make sure you have the model you want set as the current model
- Close Xcode
- Right click on "Model.xcdatamodeld" in Finder
- Choose Show Package Contents
- Delete the models you no longer want
- Right click on "MyProject.xcodeproj"
- Choose Show Package Contents
- Open project.pbxproj in a text editor
- Search for ".xcdatamodel" and delete entries (Model.xcdatamodel and "Model X.xcdatamodel") no longer in use
- Careful not to delete ".xcdatamodeld" files
- 确保您有想要设置为当前模型的模型
- 关闭 Xcode
- 在 Finder 中右键单击“Model.xcdatamodeld”
- 选择显示包裹内容
- 删除不再需要的模型
- 右键单击“MyProject.xcodeproj”
- 选择显示包裹内容
- 在文本编辑器中打开 project.pbxproj
- 搜索“.xcdatamodel”并删除不再使用的条目(Model.xcdatamodel 和“Model X.xcdatamodel”)
- 小心不要删除“.xcdatamodeld”文件
Hope this helps, Rob
希望这会有所帮助,罗布