简体   繁体   English

Xcode 项目导航器中未显示某些文件

[英]Some files not showing in Xcode project navigator

I added two files and a core data model to my Xcode project yesterday, and after saving I went off, but came back this morning to find they are not there.我昨天在我的Xcode项目中添加了两个文件和一个核心数据model,保存后我就走了,但是今天早上回来发现它们不存在。 When I look in the project files, they are still there, but they, are not showing in the project navigator.当我查看项目文件时,它们仍然存在,但是它们没有显示在项目导航器中。

When I build and run the app it doesn't crash (As in when I go on the views with one of those files, it recognises the file.)当我构建并运行该应用程序时,它不会崩溃(就像我在视图上使用其中一个文件 go 时一样,它可以识别该文件。)

Is this a common problem and is there a way to fix this?这是一个常见问题吗?有没有办法解决这个问题?

Thanks in advance, any help is much appreciated在此先感谢,非常感谢任何帮助

Edit: I do get this error though:编辑:虽然我确实收到了这个错误:

Failed to load model named [Project_name]
CoreData: error:  Failed to load model named [Project_name]

Just a little more to add is that when you drag and drop the files in the Xcode project also remember to tick and add the dependencies related to that file as Xcode itself Will add all the dependencies with it. 还有一点要补充的是,当您在Xcode项目中拖放文件时,还要记住勾选并添加与该文件相关的依赖项,因为Xcode本身将添加所有依赖项。

** **

Do not directly put anything in the folder and open As Xcode will not add files in that way 不要直接在文件夹中放任何东西并打开因为Xcode不会以这种方式添加文件

**, you have to have Xcode open and then drag and drop so that it can add other files related to that file. **,你必须打开Xcode,然后拖放,以便它可以添加与该文件相关的其他文件。

Ok I figured it out, and will post here in case anyone else has the same problems. 好的,我想出来了,并会发布在这里以防其他人有同样的问题。

1) Using Finder, take the files out of your project. 1)使用Finder,从项目中取出文件。

2) Then drag them from finder into the project navigator, and do any actions needed eg making groups etc to restore the state it was in before. 2)然后将它们从finder拖到项目导航器中,并执行所需的任何操作,例如制作组等以恢复之前的状态。

3) Save the project, close it and reopen it to check that everything is all good. 3)保存项目,关闭它并重新打开它以检查一切都是好的。

Some files do not show up in the Xcode Project navigator because they were probably added from outside of Xcode .某些文件不会显示在Xcode 项目导航器中,因为它们可能是从Xcode外部添加的。

ie, Finder:即,查找器:

在此处输入图像描述

Project Navigator:项目导航器:

在此处输入图像描述

It would be better if you add them from inside project navigator(Xcode).如果您从项目导航器(Xcode)内部添加它们会更好。

  1. Goto the navigator and Right-click on any directory in which you want to add files/folder.转到导航器并右键单击要在其中添加文件/文件夹的任何目录。
  2. Click on Add Files to <ProjectName>单击Add Files to <ProjectName>

在此处输入图像描述

  1. Now Select files/folder that you want to add现在选择要添加的文件/文件夹
  2. Then click Add .然后单击Add

在此处输入图像描述

Now all Files/Directories (that you have selected) will be added in your project.现在所有文件/目录(您选择的)都将添加到您的项目中。

Some files do not show in XCode Project navigator because they are added in finder.某些文件不会显示在 XCode 项目导航器中,因为它们是在 finder 中添加的。 It woluld be better if you add them from inside project navigator.如果您从项目导航器中添加它们会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM