Xcode file missing from the editors - ios

Hello guys I am jumping into a really weird problem that most of my files are missing from the Xcode editor. I can still compile and run the app, also all the files are still there in my project folder, but I just cannot see them in the Xcode editor anymore. I can have them back to editor by open each file one by one, however when I close xcode and reopen everything is gone again. Can anyone help me please, this is the picture.Only few files left

Please disable the recent view button at bottom of xcode.

Go to your project folder from Finder and search for the missing file. Just drag and drop the files in yor xcode.
If files are missing from the project directory then you need to create the new files with same name.

Make sure you're not adding those files just by reference. You must copy it with correct target.

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 8 red files but not missing

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.

Xcode- 7: No such file or directory

I keep trying to run my Xcode project (titled "YidKit") and it keeps giving me the following error:
error: /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest: No such file or directory. I spent several hours online, trying different solutions that I've seen, and nothing has worked. This is driving me crazy, because it is the only error left and I just finished getting rid of about 80 that were caused by Swift 2.0. I appreciate all of the help I can get!
UPDATE
Here is an image of the file in the explorer. The red one is the file that is giving me the error.
do following two things I might solve your problem.
Product -> Clean and build folder
Go to finder -> library -> Developer -> Xcode -> Derived data
delete that folder
or check screen shot may be this is your problem
and then check
TARGETS --> Build Phases --> search file --> delete redundant .m
For future reference
One way you can solve this problem is to open your Project with a text editor and search for the file there. It should be there the file path for it. Just delete it and any references that might exist of the file.
It should be working now.
Don't forget to BACKUP FIRST before doing this
Go to project, target, build phase
remove the files causing problem (click - below)
add the files again (File -> Add Files to Project)
clean then run
I'm sure you've figured out a workaround by now but for those still running into this problem the error is occurring because Xcode is trying to access a file for your project, but it can no longer find it. In your case the file it can't find is YidKitTests.xctest, so what you can do is click on it in the Project Navigator, then on the right in the File Inspector, click on the little folder icon under Location. When you click on the folder a Finder window will open up and its your job to navigate to where the YidKitTests.xctest file should be and double click on it. More often than not the file is in the exact place Xcode says it isn't, eg. /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest, but for some reason it can't see it without you pointing it out. I hope this helps!
I had a similar error popping up, and it turned out being the simulator was not being found. So, I deleted all my simulators and and added new ones. This fixed it for me. It's pretty unlikely this will be a fix for you, but I really wish I had seen this response 3 hours ago.
The solution which worked with me is as following:
Go in the left panel of the Xcode to products folder then select the Tests.xctest file
In the right panel of Xcode / Target Membership, unselect Tests
Click command u
Just delete the "Derived Data" folder and compile the project again.
Anyone tried the good old trick rebooting the computer? I tried and everything worked out fine! Give it a try
You should try to edit option in folder to show more you looking then you will see some error file inside after you find it delete it! Hope this help.

App falsely reports missing file

I downloaded a git hub project, a screen recorder(ios). It said I had to also copy in Inappsettingskit, so I did. So I tried to run it on my iPod and it told me that IASKAppSettingsViewController.h and .m were missing, even though I checked, and they are there, in the correct folder.
All the files are there in the correct place. The only thing I am noticing is that the files are in red text in Xcode:
Sorry that I am such a noob. Any ideas on why these errors show up?
Just guessing here, but chances are something went wrong when you added the files to the project. Try this.-
Remove the files references from Project navigator
From finder, make sure the physical files are inside your project folder.
Drag the files from finder to Project navigator. Uncheck copy items into destination
Drag the recently added files from Project navigator to Build phases => Compile sources section

Interface Builder could not open the document ".storyboard" because it does not exist

This problem is getting me really crazy. Xcode is looking for a storyboard in my project in a differente location from my project. I tryed removing the file, adding it again, cleaning the project, etc but didn't have luck.
This is the error.
cd /Users/fmartin91/Projects/loovin/loovin-ios
setenv IBSC_MINIMUM_COMPATIBILITY_VERSION 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/..
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool --errors --warnings --notices --minimum-deployment-target 7.0 --output-format human-readable-text --compile /Users/fmartin91/Projects/loovin/loovin-ios/Build/Products/Debug-iphonesimulator/loovin.app/Base.lproj/LOOVProductIndex.storyboardc /Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard
/* com.apple.ibtool.errors */
/Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard:
error: Interface Builder could not open the document
"LOOVProductIndex.storyboard" because it does not exist.
I could fix this bug by killing ibtoold:
$ sudo killall -9 ibtoold
Why does ibtool need a daemon anyway?
Your storyboard is not in NSBundle mainbundle.
this problem is probably due a "Copy Bundle Resources" in "Build phases" problem.
For corrected it verify if your storyboard file is in "Copy Bundle Resources" for all targets. On project navigator select the project file select Build phases tab and check it is.
When you upload your file to google drive without zip, it appends the extension of .storyboard to .xml automatically and hence when you download it obviously the file won't exist.
To solve this issue, go to the:
[project folder] > [Project folder] > [Base.lproj]
There would be a .storyboard.xml extension type of file which you would have to rename it to the .storyboard extension. And hence your work is done.
Story board error solving visual guide:
I had a very similar problem and it took a few hours to resolve. Clearly xcode locked itself in some strange state that the project explorer could see the xib file while the compile could not. Finally this got resolved when I changed the Location in the File Inspector from Relative to Group to Relative to Project. I got this by comparing the project.pbxproj file in a regular text editor to search for any clues.
I encountered this same issue and here's how I resolved it:
Save a copy of the affected file outside of the project
Delete the file from the project, selecting Move to Trash to completely delete the file and reference from the project
Edit ProjectName.xcodeproj/project.pbxproj to remove all lines referencing the affected file
Re-add the file, making sure to check Copy items into destination group's folder (if needed)
Clean and build
I just ran into this issue running Xcode 9.2. I had copied my files from a school computer onto google drive and then downloaded them at home.
When I opened the files at home it kept telling me main.storyboard and the launch storyboard did not exist. The two storyboard files would display as xml, so they clearly existed, but even right clicking to "open as" produced nothing. After much troubleshooting I found a fix that worked for me.
SOLUTION:
Open your project folder, then the next folder named the same as your project. Open Base.lproj and you will see your two storyboards in xml format. Copy both the files, paste them into the same folder, delete the .xml and confirm the change to .storyboard. Do this for both files and you're set!
This happened to me after a git merge. I changed some storyboard localized files from one project to another and Xcode seems to keep on searching the file in the old project.
My solution was:
Edit the OldProjectName.xcodeproj/project.pbxproj
Search for the Storyboard name
Delete the references to the Storyboard name that appear followed by localization stuff (things like "Base.lproj", "es.lproj", etc)
Delete also the following localization entries (because they refer to the Storyboard file)
Clean and build
Repeat if other files keep throwing compile errors
For me I use xcode 10,
Click on the your project name (blue icon on left) > Build Phases > Under Copy Bundle Resources
Find the file, remove the duplicates if it’s there. Clean project and run again
I encountered same problem when moving the project to another computer. I followed below steps to solve this issue:
Open previous Main.storyboard file as Source Code, copy all
Create a new Main.storyboard file, Open as Source Code, paste
Delete previous Main.storyboard
Clean and build project.
In my case I found that the storyboard was placed in a group that referenced a folder that did not exist in the "Identity and Type" panel.
Removing that group and the storyboard, and adding it back referencing an existing folder solve the problem for me.
For me resetting the container folder of Main.storyboard file worked
I resolved this by doing this:
Open your Xcode project folder in finder, then find the file that you can't open.
Drag that file to your file path in Xcode Project (Inside Xcode App) like this.
Thick "copy item if needed" and choose "create folder references" and then click finish.
Restart Xcode
I could solve my issue, i really don't know how i did it but the things i tried were cleaning and building the project like a billion times, i hope this will be of help to anyone.
I just experienced this, and fixed it by restarting the darn computer. I found out more about it, though. In my case, my ibtool scripts weren't working, giving file-not-found errors just like yours. However I noticed a change in behavior when I ran them as sudo:
2013-09-20 20:49:40.339 Interface Builder Cocoa Touch Tool[58454:303]
CFPreferences: user home directory at
file:///var/root/Library/Application%20Support/iPhone%20Simulator/User/
is unavailable. User domains will be volatile.
Subsequent commands would fail or return without doing anything. So! ibtool/Interface Builder/whatever is somehow using some other launching service to run itself, with some other username or privileges.
Could it be that I installed some tool updates for Xcode 5.0, and it screwed up whatever serving process was running? Yes it could :)
I experienced the same situation with Xcode 7 beta 5. Rebooting my Mac did the trick.
Goto Build Phases > Copy Bundle Resources > Check for the Storyboard for which you are getting error > It should be displaying as blurred > If YES then delete its reference and add it again > Compile again.
In my case, folders in the project navigator and finder were not formed exactly the same. The Main.storyboard was in \Views folder in the project navigator but not in finder. Xcode wouldn't let me quit the app, because Main.storyboard couldn't be saved.
Here's what I did, that solved this problem:
Identify which files are missing or misaligned in your project navigator and finder simultaneously.
Copy Main.storyboard and other files that are not in their right place to a safe location.
Force quit Xcode from Activity Monitor. Reopen Xcode.
Paste previously copied files in finder. Make sure that the folder order is the same as the Xcode project navigator.
In Xcode, from project navigator right-click to where you need to add files and click add new files.
Add files from the finder.
Clean and build.

Resources