在删除/添加一些png文件到项目后,我在构建项目时收到了消息。

"文件ProjectPath\aaa\xxx.png在工作副本中丢失。"

所有这些文件都在项目中,应用程序正在运行。然而,这些信息很烦人。查看。plist文件,但没有提到这些文件。 我应该怎么做才能删除这些信息?


当前回答

In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.

我认为,正如上面提到的,这是一个git问题,但当我运行“git ls-tree -full-tree -r HEAD”时,我根本看不到文件??

无论如何,为了解决这个问题,我所做的就是使用“Add File…”菜单命令将每个文件添加到默认位置,进行干净的构建,然后从项目窗口中删除它们(使用move to trash),这样就消除了所有错误。

其他回答

我有同样的问题,并通过简单地将指定的文件从finder拖到项目导航器(确保“复制文件”在对话框中被选中)并提交文件来解决它。

再加上亚历山大·瓦塞宁的答案……

首先,我承诺并推动我的改变

Xcode主菜单>源代码控制>提交

然后我放弃了所有的更改,以摆脱错误

Xcode主菜单>源代码控制>放弃所有更改

在此之后,“文件xxx.png从工作副本中丢失”的错误消失了。

我不得不手动进入终端,用git rm ProjectPath\aaa\xxx.png删除文件,然后提交。从那以后,一切都很顺利。

这肯定与源代码控制有关。我重命名并移动了几个未提交的plist文件,得到了这个错误。我使用svn。我可以通过源代码控制-提交删除旧的引用文件来修复这个问题。

您还可以通过取消勾选来禁用源代码控制

Xcode ->首选项->源控制->启用源控制

如果你通过命令行或任何其他应用程序来管理它。