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.
Related
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.
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.
My project was working perfectly fine. I then moved some files around from the project's root directory to some subfolders. Now, when I try to run the app, I receive this error message:
<unknown>:0: error: no such file or directory:
'/Users/anapaix/Desktop/currencyExchange/CommentsController.swift'
And I receive this same error for all 20 of the files that I moved around.
Additionally, the files now show up in red like this in my project:
When I double click the file, an empty Swift file shows up, like there is nothing inside. I have a feeling there should be some easy fix to this, in order for Xcode to recognize these files, but just have no idea what it would be.
You moved the files. Xcode doesn't know that. You need to tell Xcode where the files are. (Note: the other answers work too, but if you don't want to remove them and add them again, you can use this method)
Select your red file(s), open the File Inspector (Option+Command+1), and click the folder (circled in red in the below screenshot). Then find your file(s) and click Choose. The filenames should go back to being black.
If multiple red files are in the same folder, you can select multiple files in the Project Navigator (left column, Command+1), click the folder icon in the File Inspector (still the one circled in red, but the text will be different; it might say "multiple selected" or something) and click the folder containing the files. Xcode should automatically detect all of them, provided the filenames haven't changed.
Go Xcode->File->Add Files... and add missing files to the project.
when you move any file in finder from the projewct workspace then xcode doesn't recognize the new path automatically, and xcode consider it as deleted. So,Please remove this files that are in red colour in your explorer.
Then again drag the files from the finder in to your project.
This way your project found the new file path of files for the compling.
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>
...
To manually include a number of “library” files into my project, I open my project in xCode. And then I open the “library” folder in finder. Then I drag and dropped from the folder into my project. But now when I go to Buid Phases > Compile Sources I see the path of the files I just copied to be …/download/… instead of /project/.... This is bad because when I push to git, the files aren’t passed along and they look red on the computer of anyone else who sync, for the obvious reason that the path specified does not exist on their machines. How do I fix this? As in, when I drag and drop I was expecting for the files to be copied and not just referenced. But they weren’t. Is there a simple fix? Note: I mark “copy items into destination group’s folder (if needed)”.
Also when I open my project in finder, the group that is supposed to have the "library" files isn't in there.
This is a tricky one. But I can assure you it is human error (well, I think anyway). Do this:
Right click on the group and select "show in finder". You will see that the group belongs somewhere else. So as long as you keep adding to the group, it won't really ever show up in your project. To fix, delete the whole group, type the group by hand, and then try drag and drop again.