什么是 Xcode“没有这样的文件或目录错误"? [英] What's the Xcode "no such file or directory error"?

查看:30
本文介绍了什么是 Xcode“没有这样的文件或目录错误"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode 不断提示,告诉我项目中没有特定图像,并且在我尝试构建时出错.如果我从项目中删除了 Xcode 抱怨的 .png,为什么在我尝试构建时 Xcode 会出错?

Xcode keeps prompting telling me I don't have a certain image in the project and it errors when I try to build. If I deleted the .png Xcode is complaining about from the project, why does Xcode error out when I try to build?

[由大黄编辑(评论太大)]

我对这些细节也有同样的看法.复制命令看起来像这样

I'm getting the same thing with these details. The copy command looks like this

CpResource MyIcons/../13-bicycle.png /Users/Me/Library/Developer/Xcode/DerivedData/MyProject-cxsohyxdecdbptgrrtaixbhhixrj/Build/Products/Debug-iphonesimulator/MyProject.app/13-bicycle.png

然后有一堆 setenv 并且命令被翻译为builtin-copy",但这些都不重要,结果是当我编译时出现此错误:

then there's a bunch of setenv and the command is translated to "builtin-copy" but none of that matters, the result is when I compile I get this error:

错误:/Users/Me/Development/MyProject/MyIcons/../13-bicycle.png:没有那个文件或目录

error: /Users/Me/Development/MyProject/MyIcons/../13-bicycle.png: No such file or directory

现在,我按照 Robert Harvey 的建议打开了 Copy Bundle Resources 选项卡,我的 .png 就在那里,但没有任何内容出现在读取中.它位于文件系统 (Finder) 和项目导航器中.因此,我使用 - 按钮将其从资源中删除,并使用 Copy Bundle Resources 选项卡中列表左下方的 + 按钮手动添加它.这将它放在导航器中项目的根目录,所以我再次将它移到我的组中 - 但没有运气,同样的错误.所以我只是完全删除了它(从项目导航器中,允许将其移至废纸篓).那行得通,但我在下一个图标上遇到了同样的错误(一次只报告一两个).

Now, I opened the Copy Bundle Resources tab as suggested by Robert Harvey, and my .png is there, with nothing appearing in read. And it is in the file system (Finder) and in the Project Navigator. So I deleted it from the resources using the - button and added it manually using the + button at the bottom left of the list in the Copy Bundle Resources tab. This put it at the root of the project in the Navigator, so I moved it into my group again - but no luck, same error. So I just deleted it altogether (from the Project Navigator, allowing it to be moved to Trash). That worked, but I ran into the same error with the very next icon (it only reports one or two at a time).

看错误信息,好像认为MyIcons是一个文件夹.不是,这只是一个群体.没有这个文件夹,我在文件系统中可以看到.

Looking at the error message, it appears to think that MyIcons is a folder. It's not, it's just a group. There is no such folder, I can see in the file system.

当我通过拖放添加时,我选中了将项目复制到...组文件夹(如果需要)"并选中了为任何添加的文件夹创建组"按钮.但请注意,我只将图标(整体)拖到现有组中;我没有拖过任何文件夹,也没有拖过任何创建的组或文件夹.但不知何故,编译器认为这些资源在文件系统中不存在的文件夹中.

When I added via drag-drop, I left the "Copy items into ... group folder (if needed)" checked and the "Create groups for any added folders" button selected. But note that I only dragged icons (en masse) into an existing group; I did not drag over any folders, nor where any groups or folders created. But somehow, the compiler thinks that these resources are in a folder in the file system that doesn't exist.

我右键单击了复制资源列表"中的图标,并尝试了在 Finder 中显示和在项目导航器中显示:两者都有效 - 文件在那里并且它知道从哪里获取它 - 直到它构建.

I right clicked the icon in the Copy Resources List and tried both Show in Finder and Reveal in Project Navigator: and both worked - the file is there and it knows where to get it - until it builds.

我什至没有找到除删除图标之外的解决方法 - 清理不起作用.我认为我的组已损坏.

I haven't even found a workaround beyond deleting the icons yet - cleaning doesn't work. I think my group is corrupted.

推荐答案

在此处查找 XCode Build – CopyPNGFile 错误并且没有这样的文件或目录.我遇到了同样的问题,这个解决方案对我有帮助.

look up here XCode Build – CopyPNGFile Error and No Such File or Directory . I had same problem and this solution helps me.

如果您在构建您的系统时收到这些烦人的错误中的任何一个xcode 应用程序,您的项目包中的某些内容已损坏.

If you receive either of these annoying errors when building your xcode app, something has corrupted in your project bundle.

  1. 在 Xcode 中打开您的项目
  2. 点击您的项目
  3. 在目标"下点击您的项目
  4. 点击构建阶段标签
  5. 打开底部附近的复制捆绑资源"
  6. 查找任何以红色列出的资源!

这篇关于什么是 Xcode“没有这样的文件或目录错误"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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