Xcode 8 red files but not missing - ios

I just saw a weird error on one of my iOS projects.
I'm using Xcode 8 (last release). I have some classes that I share along with other projects. This files are added to the project by reference, in case I need to edit them, I do it just once.
Everything works fine. But I saw that many of this files are on red in one of my projects. The weird thing is that everything works well. All libraries are included, everything runs perfectly. Like I said, the files are marked as red and I can not edit them directly from that project but they are not missing (paths are OK), I cannot go directly to the folder using "show on finder" option.
I tried replacing the folders. Also tried to added and copy them to the project folder. But nothing seems to be working.
I know, there are many threads about this issue but none of them worked for me because my files are not missing.
Did someone see this issue?
PS. I'm using git.

Select the file in the Project navigator on the left, then open the right side Utilities view and select the File inspector. Then click on the little folder icon and make sure that points to the right path.

I have the same problem - definitely not missing files. This is too late for OP but for anyone finding this ... it might help to change the file 'Location' setting from "Relative to Group" to Relative to Project" and then clicking on the folder to reselect the file. It worked for me. I think the path of the group can get messed up.

I would suspect that the files are missing, but Xcode is able to still compile because it's picking up older version from the derived data directories.
I would suggest clearing your derived data to be sure.

the files are marked as red and I can not edit them directly from that project but they are not missing (paths are OK), I cannot go directly to the folder using "show on finder" option
Then the paths are not OK. You need to find these files and add them to the project again. Then delete the red file references.

Related

iOS My application.xcodeproj causes and display red text, Then I unable to open project?

I have facing this issue when I was changing project name and copying my project from one mac to another. There are some red texts indicate the missing files from the project source codes(But I have all files in Project folder) I have used cocoapods in this project. How to avoid these?
Here I have shown my project screen shot.
As per your description... you must be having some issue in your project.pbxproj file. Please check that file. Common issue happens in that file when you try to merge different branches having conflicts in project structure.
There could be different reasons of this:
It may happen because the xcode is open and the source folder is not available.
It may happen when source path is not found in your system and xcode shows that.
For resolving this, quiet xcode and reopen your source from .xcodeproj again, will resolve the problem.
Click on the file, then on the far top right of Xcode look under Identity and Type Check and see if the path to the file is correct. In my case is was not so I had to click on the small folder icon (not the arrow icon) and select the folder in finder.

Xcode 9 - Some folders marked with red text

In my project, there are some folders that have red text.
The project compiles and everything works, but I can't understand why only some folders have red text.
Check this.
It means they are not found on disk where your project believes they should be. Control-click and Show In Finder to see the folder location to locate the file and drag it back in to the project, and delete the bad reference.Missing. Maybe you moved them somewhere without deleting them from the project or something.
Edit: Don't delete it before add it first, and you should save backup from the files in another folder, also you have to use source controls like Bitbucket, GitHub, or GitLab.
The UI error feedback notifies you that the path is not found. You can select a new one using the folder icon in the right panel. In this way, all files in the folder keep the configuration so it is more convenient.
I illustrate it in the above screenshot.

Xcode not able to find project file

In my Xcode project there are other projects linked but somehow its not able to read the sub project.
As you can see MobiResourceManager.xcodeproj is shown in red. And thus the classes which uses headers inside it gives error. But I am not able to understand why its not able to show the project. Sometimes it doesn't show MobiResourceManager.xcodeproj in red but even then the classes using its header gives error of HeaderName.h not found.
The problem that I am facing is happening only in my system. I tried cleaning, deleting-installing Xcode, cloning the repository again but nothing works.
All the project file shown in the screen shot are sub project inside one main project.
Probably that red file was removed or moved somewhere else. Open Finder, locate the missing xcodeproj, then remove this one in Xcode and drag&drop the located one. If that red xcodeproj is inside your repository (what I suspect) then do not select to copy it to the destination.
If you cannot locate that red file, it means it is not added to the repository. For example, it could mean that you need to install it with git submodules or another way - depends on the project configuration.
Are you using the workspace? if yes then please open that file not xcode project file

Files in Xcode not working (names in red)

I renamed my app folder to try and change the name of the app because it didn't work in the project navigator and when I did so, all files came up in red. I have tried to fix it by renaming the files back to how they were but it still doesn't work.
Any help would be greatly appreciated.
Link to dropbox: https://www.dropbox.com/s/omvo0saff0z9ncc/TicketekApp%202.zip?dl=0
If files marked in red, they are "not found" by Xcode.
You either moved or deleted them within File Finder, outside Xcode.
Delete the red marked files within XCode, then add them again to XCode.
This will solve your problem.
I solved this problem as follows:
click on the Group name in which file names are showing in red colour in the Xcode navigation area (Navigator) on the left side. In the Utility area on the right side in Xcode open up File Inspector tab. There is a Field named Full Path:, click on the arrow placed last to the path. You will have popup window showing your project path. Change The Group Folder in which you already moved your files from Finder.
In my case after moving the projects to a new folder and fixing each file location, the project compiles properly but the files names were still in red.
The problem was that the files were grouped in groups. The group was the cause of the red names of the files. So I added new groups, with identical names to the old ones (Xcode allows to do it since it does not know were is the old group), moved the files from each group to it's new group and deleted the old groups.
Now all the red names are gone.
For me, I had to make a new folder again and add everything back
Another reason for this problem might be your project.pbxproj file. In my case, after doing a git merge, one of the PBXGroups missed a line of code. After comparing it to the others and adding the missing line, problem disappeared.
In my case I had a contents.xcworkspacedata file that had the below, an absolute pathname to a couple of files (just 2 out of about 40). When I checked the project out on a different machine, it showed these files as "red" (makes sense, the newly checked out project is in a different location). I don't even know how a couple of files ended up in here. It just doesn't make any sense to use absolute paths at all.
To fix, I just modified this file to remove those lines, moved the files away into a tmp dir (since they were there), and added the missing files in Xcode.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:/Users/jack/projects/myapp/myapp/MyController.swift">
</FileRef>
<FileRef
location = "group:/Users/jack/projects/myapp/myapp/CustomView.swift">
</FileRef>
...

How to add groups of files?

I am trying to add the shareKit files like in the photo:
...but Xcode will only let me do the drag and drop only for single files! How can I solve this?
What you need to do is simple:
1) Right click the sharekit folder in the first project and you will see show in finder. Click that.
2) That will lead to the folder in your directory.
3) Next pull the whole directory into second project. Make sure you copy the files over.
Hope this helps...
In Xcode 4 it is different than older Xcode you have in the screenshot. To copy between projects, you have to open them in the same workspace (the same window). So
open the first project
drag the second one from finder to the same Xcode workspace
now drag the files you need
remove the second project from your workspace.
Lakesh's approach might have a risk in fact, that sometimes file structure you see in xcode might differ from what is actually on filesystem.
You might want to try ShareKit 2.0, it is already packaged as a static lib and has updated sharers to match newest api's. If you decide to use it, make sure to follow install wiki guide literally.

Resources