xcode 复制文件时出现多个错误 - 但是,我能看到它们是什么吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16008433/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:13:04  来源:igfitidea点击:

Multiple errors ocurred while copying files - but, can I see what they are?

xcode

提问by Voldemort

There were around 200 files I had to delete in my Xcode project (and yeah, they were deleted properly), and now I have to copy 200+ files are supposedly replace the ones I just deleted.

我不得不在我的 Xcode 项目中删除大约 200 个文件(是的,它们被正确删除),现在我必须复制 200 多个文件,据说这些文件将替换我刚刚删除的文件。

I keep getting "Multiple errors occurred while copying files". The Xcode window doesn't show the newly-added files, but if I explore the project folder using the Finder, I can see that the files were indeed added - well, there most likely was a certain file that could not be copied and thus caused the error. Problem is, I have no idea which one nor why.

我一直收到“复制文件时发生多个错误”的消息。Xcode 窗口不显示新添加的文件,但如果我使用 Finder 浏览项目文件夹,我可以看到确实添加了文件 - 好吧,很可能是某个文件无法复制,因此导致错误。问题是,我不知道是哪一个,也不知道为什么。

Now then, is it possible to get Xcode to tell me what the problem is rather than telling me there is one?

那么,是否有可能让 Xcode 告诉我问题是什么而不是告诉我有问题?

Edit: Okay, I did discover that some of the new files shared the same name as some files that were not listed in Xcode, which explains the error. However, I am still interested in knowing whether there is a way to know that the "Multiple errors" actually are whenever Xcode says t his.

编辑:好的,我确实发现一些新文件与一些未在 Xcode 中列出的文件共享相同的名称,这解释了错误。但是,我仍然想知道是否有办法知道“多个错误”实际上是每当 Xcode 说他的时候。

回答by Chysn

When Xcode finds a duplicate file, it generates this error, and then it fails to add references for the files that it didmanage to copy.

当Xcode中找到重复的文件,它生成此错误,然后它不能添加引用的文件,它设法复制。

Rather than deleting files from the finder and starting over, you can do this:

您可以这样做,而不是从查找器中删除文件并重新开始:

  1. Open the Finder for your project, where your source files are located
  2. Command-click the ones for which your references are missing (and if you click others, it won't really matter)
  3. Drag them into Xcode. When the confirmation dialog comes up, unset the "Copy items into destination group's folder (if needed)" checkbox. This will tell Xcode to make references only.
  1. 打开项目的 Finder,源文件所在的位置
  2. 按住 Command 键单击缺少引用的那些(如果单击其他,则无关紧要)
  3. 将它们拖入 Xcode。当确认对话框出现时,取消设置“将项目复制到目标组的文件夹(如果需要)”复选框。这将告诉 Xcode 仅进行引用。

回答by Dario

I deleted the files from finder and then added again the files via Xcode, that worked for me.

我从 finder 中删除了文件,然后通过 Xcode 再次添加了这些文件,这对我有用。

回答by puneeth

This error sometimes occurs when the code is not merged properly. The missing files will not be available in Xcode but once you open the finder containing this project, you will be able to spot the missing file.

当代码未正确合并时,有时会发生此错误。丢失的文件在 Xcode 中将不可用,但是一旦您打开包含此项目的查找器,您将能够找到丢失的文件。

The simplest way to add these missing files back to the project is:

将这些丢失的文件添加回项目的最简单方法是:

1) In your Xcode, navigate to Build Phases Tab.

1) 在您的 Xcode 中,导航到 Build Phases 选项卡。

2) Under Compile Sources, tap on '+' to add back the missing file.

2) 在编译源下,点击“+”以添加回丢失的文件。

Sometimes the missing files will be greyed out in the build phases, just tap on '-' and add them back.

有时丢失的文件会在构建阶段变灰,只需点击“-”并将它们添加回来。

回答by Narasimha Nallamsetty

For me this is worked. I tried to add files which are already in my bundle. So make sure you are not adding files which are already added. I hope it helps someone.

对我来说这是有效的。我试图添加已经在我的包中的文件。因此,请确保您没有添加已添加的文件。我希望它可以帮助某人。