尝试添加文件时,收到错误消息:操作无法完成。文件存在
我需要替换我的应用程序中的一些图像。结果我从 Xcode 中删除了它们,现在当我尝试再次添加它们时,我收到此错误:
我确信该文件在项目中不存在,因为我刚刚删除了它。另外,当我尝试查找该文件时,它不存在。
I need to replace some images in my application. As a result I deleted them from Xcode and now when I try to add them again I get this error:
and I am sure that that file does not exist in the project because I just deleted it. Also when I try to look for that file it does not exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
试试这个:
希望这有帮助
Try this:
Hope this helps
它与我不久前提交的 Xcode bug 有关:
It's related to an Xcode bug I filed a while ago:
在第一个错误之前复制的文件仍然存在,只是尚未添加到目标中。您需要使他们成为目标成员。 xCode 3.x 中的行为也是相同的。因此,完成此操作后,只需将剩余的文件拖到项目中即可。
the files that were copied prior to the first error are there, they just have not been added to the target. You need to make them members of the target. It was the same behaviour in xCode 3.x. So after you do that, just drag the remaining files into the project.
就我而言,有一个现有文件不知何故不想被覆盖。在终端上,执行 a
然后尝试再次将文件添加到 Xcode。
In my case, there was an existing file that somehow doesn't want to be overwritten. On the terminal, do a
Then try adding the file again to Xcode.
我通过进入项目的文件夹并删除旧文件然后再次添加它们来纠正错误
I corrected the error by entering the project's folder and deleting the old files and then added them again
我在删除 xcode 内文件夹的内容然后将与文件夹先前内容同名的文件添加到项目后遇到了这个问题。
删除 xcode 中现在为空的文件夹后,问题消失了......
希望它可以帮助别人!
I got this problem ater deleting the contents of a folder inside xcode and then adding files with the same name as the folders previous content to the project.
After deleting the now empty folder inside xcode the problem disappeared...
Hope it helps someone!
添加额外图像时遇到同样的问题,因此检查了 Finder 中的实际文件夹位置,发现有所有文件,但 Xcode“资源管理器”中没有。因此,只需右键单击“资源管理器”中顶部的项目图标并选择“添加文件”...这一次,它确实导入了所有内容,虽然导入到了项目的根目录,但只是将图像拖到了 Images 文件夹中并删除了 2先前已识别的文件的重复项。它询问是否删除引用或移至垃圾桶,我选择了前者。执行“清理”、“构建”、“运行”。现在可以正确运行了。
Had the same problem adding extra images, so checked the actual folder location in Finder and there were all the files, but not in the Xcode "explorer". So just right-clicked on the top project icon in the "explorer" and selected Add Files... This time, it did import everything, although to the root of the project, but just dragged the images to the Images folder and deleted 2 duplicates of files that were already recognized previously. It asked whether to remove references or move to trashcan and I selected the former. Did a Clean, then Build, then Run. Now it runs correctly.
我遇到了同样的错误,并且能够解决它:
当我删除(“移动到垃圾箱”按钮)xcode 中的原始文件时,这些文件以某种方式被移动到另一个文件夹而不是被删除。因此,在 Xcode 中删除(“移至垃圾箱”)文件后,它们仍然存在。在查找器中,我查看了我的项目文件夹,终于在新文件夹中找到了文件。从 Finder 中的新文件夹中删除文件后,我可以在 Xcode 中再次添加这些文件。
I got the same error and I was able to solve it:
When I deleted ("move to trash"-button) the original files in xcode, the files somehow were moved to another folder instead of being deleted. So, after deleting ("move to trash") the files in Xcode, they were still there. In finder, I looked at my project folder and finally found the files in the new folder. After I deleted the files from the new folder in finder, I was able to add the files again in Xcode.
如果您收到此错误并且已经从 Xcode 中的项目中删除了文件。
1.导航到项目存储在其目录中的位置,然后从最初存储在项目文件夹中的位置删除图像,可以是 images 文件夹或 images-xassets 文件夹。然后删除图像或图像。
2.返回你的Xcode--Product-Clean..然后Build,
3.然后再次尝试添加您的图像。
If you you are getting this error and already deleted the files from your project in Xcode.
1.Navigate to where the project is stored inside its directory and delete the image from wherever you initially stored it inside your project folder,it can be the images folder or images-xassets folder..then delete the images or image.
2.Return to your Xcode--Product-Clean..then Build,
3.then try adding your image again.