Why xcode can't see these files, however they physically exist

☆樱花仙子☆ 提交于 2020-12-29 09:16:39

问题


Xcode run into compilation error while running the code.

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

??? enter image description here


回答1:


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.


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

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.




回答2:


Tested in xcode 11

You have to add them to your project by pressing right-click on the app folder Add files to "app"... select all the missing and NEEDED files, click on create groups option and press finish.




回答3:


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:

  1. select the file (.m file) that causing this error.
  2. select the file inspector
  3. make sure that your Target is selected in the check box.

  • NOTE: you can't link .h files to the target, only .m and .swift



回答4:


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.



来源:https://stackoverflow.com/questions/17610469/why-xcode-cant-see-these-files-however-they-physically-exist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!