为什么 xcode 看不到这些文件,但它们实际存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17610469/
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
Why xcode can't see these files, however they physically exist
提问by Hymanie Chan
Xcode run into compilation error while running the code.
Xcode 在运行代码时遇到编译错误。
Unfortunatetly I was not able to find a solution online.
不幸的是,我无法在网上找到解决方案。
These steps that I have commenced:
我已经开始的这些步骤:
=> git merge branch-name => can't find the files => git checkout branch-name file-name => files were physically found => xcode can't see it
=> git merge branch-name => 找不到文件 => git checkout branch-name 文件名 => 文件被物理找到 => xcode 看不到
???
???
回答by Heckscheibe
You have to add them to your project at File -> Add Files To "Your Project"
您必须在文件 -> 将文件添加到“您的项目”中将它们添加到您的项目中
btw: Your project folder in Xcode does not necessarily reflect your actual folder structure you see in finder.
顺便说一句:您在 Xcode 中的项目文件夹不一定反映您在 finder 中看到的实际文件夹结构。
Edit:
编辑:
if you want it to be like that (Xcode folders are the same as the existing folders in your harddrive) I found a nice tool which does that for you: https://github.com/venmo/synx
如果您希望它像那样(Xcode 文件夹与硬盘驱动器中的现有文件夹相同),我找到了一个很好的工具,可以为您做到这一点:https: //github.com/venmo/synx
also, when creating new folders/groups in Xcode, you have to use the New Group with Folder
option to also create a folder for that group on your harddrive.
此外,在 Xcode 中创建新文件夹/组时,您还必须使用该New Group with Folder
选项在硬盘上为该组创建一个文件夹。
回答by Sosily
Maybe when you add those files to the project you did not linked them to your Target.
也许当您将这些文件添加到项目时,您没有将它们链接到您的目标。
When you add file to your project make sure it's link to your target.
当您将文件添加到您的项目时,请确保它链接到您的目标。
check the following:
检查以下内容:
- select the file (.m file) that causing this error.
- select the file inspector
- make sure that your Target is selected in the check box.
- 选择导致此错误的文件(.m 文件)。
- 选择文件检查器
- 确保在复选框中选择了您的目标。
- NOTE: you can't link .h files to the target, only .m and .swift
- 注意:您不能将 .h 文件链接到目标,只有 .m 和 .swift
回答by Madhurya Gandi
Looks like whenever I added my files to git, I never actually added MyProject.xcodeproj/project.pbxproj file. This file has all the references for new files. Make sure you add that file to your git.
看起来每当我将文件添加到 git 时,我实际上从未添加过 MyProject.xcodeproj/project.pbxproj 文件。此文件包含新文件的所有参考。确保将该文件添加到 git 中。