Xcode 错误:构建时没有这样的文件或目录

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

Xcode Error : No such file or directory when building

iosxcodebuild

提问by zbMax

I've read similar threads but wasn't able to find a solution to my issue.

我已经阅读了类似的主题,但无法找到解决我的问题的方法。

When I start my project, I first saved it in a folder with blank space in its name (let name it "My Project")
Lets also simplify the path through my project as a simple folder : "My path" (yes, there was blank spaces in the hierarchy).

当我开始我的项目时,我首先将它保存在一个名称中带有空格的文件夹中(让它命名为“我的项目”)
让我们也将通过我的项目的路径简化为一个简单的文件夹:“我的路径”(是的,有层次结构中的空格)。

I used to have issues while building my project, especially with the Library search path in Build settings, regularly coming back with xcode updates or/and duplication of project for keeping a historical.

我曾经在构建我的项目时遇到问题,尤其是在构建设置中的库搜索路径时,定期返回 xcode 更新或/和项目重复以保持历史记录。

To solved that, I've replaced all the blank spaces with underscores. So now my project's folder name is "My_Project" and the path "My_path". These changes have also been performed in the Build Settings of my project.

为了解决这个问题,我用下划线替换了所有空格。所以现在我的项目的文件夹名称是“My_Project”,路径是“My_path”。这些更改也已在我的项目的构建设置中执行。

But today, I have an error I can't get rid of.
When I build my project, every file compile perfectly, but during the "copying" process, I get this kind of error.

但是今天,我遇到了一个无法摆脱的错误。
当我构建我的项目时,每个文件都可以完美编译,但是在“复制”过程中,我遇到了这种错误。

/!\Copy AFNetworking ...in /Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder

CpResource /Users/admin/Desktop/My_path/My\ Project/Product-name/Sub\ Folder/AFNetworking /Users/admin/Library/Developer/Xcode/DerivedData/Product-name-gkplyeugxcxhijajdvpxutaodxmz/Build/Products/Release-iphoneos/Product-name.app/AFNetworking
cd /Users/admin/Desktop/My_path/My_Project/Product-name
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -strip-debug-symbols -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /Users/admin/Desktop/My_path/My\ Project/Product-name/Sub\ Folder/AFNetworking /Users/admin/Library/Developer/Xcode/DerivedData/Product-name-gkplyeugxcxhijajdvpxutaodxmz/Build/Products/Release-iphoneos/Product-name.app
-------------------------------------
error: /Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder/AFNetworking: No such file or directory

I don't find in my target's Build Settings any field where blank spaces haven't been replaced by underscores.

我在目标的构建设置中找不到任何未用下划线替换空格的字段。

Any help appreciated.

任何帮助表示赞赏。

(I'm using Xcode 7.2, OS X El Capitan 10.11.2)

(我使用的是 Xcode 7.2,OS X El Capitan 10.11.2)

回答by zbMax

I finally find somewhat by chance an answerto my problem.

我终于有点偶然地找到了我的问题的答案

I've opened the .xcodeproj file in finder, and then edit project.pbxproj. In this file, I've founded a line :

我已经在 finder 中打开了 .xcodeproj 文件,然后编辑project.pbxproj. 在这个文件中,我创建了一行:

84635D6F1C22F90100C55AB2 /* AFNetworking */ = {isa = PBXFileReference; lastKnownFileType = folder; name = AFNetworking; path = "/Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder/AFNetworking"; sourceTree = "<absolute>"; };

And retyping it properly made the trick.

正确地重新输入它就成功了。

回答by RamRovi

This medium post helped me: https://freakycoder.com/ios-notes-47-how-to-solve-xcode-no-such-file-or-directory-error-514106eaf287

这篇中等文章帮助了我:https: //freakycoder.com/ios-notes-47-how-to-solve-xcode-no-such-file-or-directory-error-514106eaf287

Needed to remove the resource under Copy Bundle Resource during the Build Phase

需要在构建阶段移除 Copy Bundle Resource 下的资源

enter image description here

在此处输入图片说明