Some files not showing in Xcode project navigator
Asked Answered
T

3

17

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. 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.)

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]
Tolbert answered 29/12, 2017 at 7:57 Comment(1)
Would anyone suggest perhaps taking the files ut the project and puttign them back in again?Tolbert
T
25

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.

2) Then drag them from finder into the project navigator, and do any actions needed e.g. making groups e.t.c. to restore the state it was in before.

3) Save the project, close it and reopen it to check that everything is all good.

Tolbert answered 29/12, 2017 at 8:15 Comment(2)
This does work and i cannot believe this is the solution. This Also happens if you use a git from the terminal. Assume you rebase or discard changes (via terminal) that added files back to the project, those files are also not visible in the project explorer...Rodriguez
yeh 2023 and we are still here with xcode 14.3.1 and merge issues on xcode project files. Files get merged and not visible.Happenstance
D
9

Some files do not show up in the Xcode Project navigator because they were probably added from outside of Xcode.

i.e., Finder:

enter image description here

Project Navigator:

enter image description here

It would be better if you add them from inside project navigator(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>

enter image description here

  1. Now Select files/folder that you want to add
  2. Then click Add.

enter image description here

Now all Files/Directories (that you have selected) will be added in your project.

Dorri answered 22/2, 2022 at 17:27 Comment(0)
K
2

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.

**

Do not directly put anything in the folder and open As Xcode will not add files in that way

**, you have to have Xcode open and then drag and drop so that it can add other files related to that file.

Kaveri answered 29/12, 2017 at 15:51 Comment(1)
Is there any other way around, let's say I generate some class and want it to be included in project?Secunderabad

© 2022 - 2024 — McMap. All rights reserved.