从Xcode中删除.xcdatamodel文件? [英] Delete .xcdatamodel file from Xcode?

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

问题描述

我做了一个轻量级的迁移,我决定不再需要了。有没有办法只删除文件?我已经将当前的模型版本更改为之前的版本,并且应用程序运行。但是,当我右键单击Xco​​de文件查看器中的.xcdatamodel文件时,删除将显示为灰色。我也尝试从Finder中删除该文件,但是它将文件保留在Xcode中,已经退出。

I made a lightweight migration that I decided I don't want anymore. Is there any way to just delete the file? I've already changed the current model version to the one before it, and the app runs. However, when I right-click on the .xcdatamodel file in the Xcode file viewer, "Delete" is greyed-out. I also tried to remove the file from Finder, but it keeps the file in Xcode, redded-out.

有没有办法解决这个问题?

Is there any way to fix this?

推荐答案

是的 - 已经做了很多,据我所知,唯一的方法就是在你最喜欢的原始文本中打开YourProject.xcodeproj / project.pbxproj编辑器(vim ftw!),搜索并删除有问题的模型文件的两个实例。即:

Yes - having done this a lot, to my knowledge the only way is to open up YourProject.xcodeproj/project.pbxproj in your favourite raw text editor (vim ftw!), and search for and remove both instances of the offending model file. Ie:

D6A5760112F22213004DEDCE /* MyModel.xcdatamodeld */ = {
  isa = XCVersionGroup;
  children = (
    D6EDB44614ED9D7E00C02938 /* MyModel-V12.xcdatamodel */,
    D6931E6214D78135007F0E03 /* MyModel-V11.xcdatamodel */,
    D61403DD14B7857100323E6D /* MyModel-V10.xcdatamodel */,
    D675476B149BD1F3007C160C /* MyModel-V9.xcdatamodel */,
    D6199DD5143DE428002869C1 /* MyModel-V8.xcdatamodel */,
  );
  currentVersion = D6EDB44614ED9D7E00C02938 /* MyModel-V12.xcdatamodel */;
  name = MyModel.xcdatamodeld;
  path = aPath/MyModel.xcdatamodeld;
  sourceTree = "<group>";
  versionGroupType = wrapper.xcdatamodel;
};

所以在这种情况下,我去寻找 D6199DD5143DE428002869C1的两个实例并从项目文件中删除它们,然后爆炸:Bob是我的叔叔。此外 - 您可以重新排序上面的那些孩子,以防您想要当前的那个更高。

So in this case, I go hunting for the two instances of D6199DD5143DE428002869C1 and delete them both from the project file, and bang: Bob's my uncle. Also - you can reorder that chunk of children above in case you want the current one higher.

在我这样做之后,我通常只在model-V8目录上执行手动源代码删除命令。

After I do that, I typically execute a manual source repo delete command on just the model-V8 dir too.

这篇关于从Xcode中删除.xcdatamodel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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