Xcode Build Input File Cannot Be Found - swift

I decided to move my controller to a folder inside of the controller folder for better organization. After doing so, I am getting a "Build input file cannot be found '/Users/.../Xcode/Development/.../.../Controller/ProfileController.swift'
I looked for an answer to this thinking this has happened a lot but the only thing turned up was missing info.plist files which I believe this is different. I moved my file to '/Users/.../Xcode/Development/.../.../Controller/Dashboard/Profile/ProfileController.swift' which caused this issue.
Any idea how to resolve this? I'm assuming you can nest folders and that shouldn't be an issue.

This looks like your Xcode project is referencing a file with an absolute path instead of relative path.

Check on "build Phases" -> "Compile Sources" if the file is listed and maybe greyed-out or duplicated. Remove all those entries from the list, remove the file from the project tree (without trashing it) and re-drop it into the project.
Check again the file in the "Compile Sources". Now there should be once. Build.

Not sure why it resolved itself but after restarting my Mac, I created another TestController inside of the new folder I wanted to reference, assigned that controller to the storyboard and finally I removed the TestController and placed my ProfileController back into the storyboard it started working.
Just thought I would post my solution for others in case it is helpful.

Related

How to correct missing files in xcode iOS project

I have a project with some missing files. The files are their own folder on the same level as the iOS app project folder. Not sure why but the files are showing up as "missing"
Is there something I can do to the Library Search Paths (see screenshot below) so they find them correctly?
fyi: I inherited the project, so it was just sent to me. I try to build it and get all those files missing.
thanks for any help :)
It's nothing to do with library search paths, they are used to find libraries to compile against; they're nothing to do with source files contained within your project.
They are missing because your project file is trying to reference a location for the file that doesn't exist. You have two options:
If you have all the missing files on hand in Finder, you can delete the references to them in Xcode, and re-import them. Do this by dragging them back into the project from Finder.
You can instead 'fix' your project file, to have it refer to the right place. To do this, use the File Inspector on the right, and under Location, select the 'box' icon (not sure what it is, but select it), and relocate your file.
open the folder in which these files are present then drag and drop the missing files in you project. check the "copy items into destination group's folder(if needed)", choose "create groups for any added folders".
Remove these files from the project view (list on the left side), drag them back into the project and make sure you don't select Copy to project, but you also have to check which target to put in.

can not find nib (xib) file

In my project there was a file named view controller.xib. I deleted a button from that and an window appear I select move to trash. And after deleting that control, I can't find my xib file. But my project is building successfully and running properly with that view. but I can't find that file in project and also from the project directory. How can i recover that xib file.
Need Help.
Thanks.
Actually when you pressed delete button, your file.xib was selected from project, instead of deleting that control button, your Xib file was deleted, by clicking this dialog button.
Now your file has been removed from your project. Look carefully what is being used instead that file.xib. may there is still another file under the same name, or you are using another file instead of this one.
As concerning the recovery of your file, you can have a look at these posts:
Recovery deleted files from Xcode
Accidentally deletion of classes from XCode 3.2.5
Check the Spotlight . Type the full name of the xib file with the extension . If you have not deleted it permanently and only clicked on "Remove Reference" only, then there is the possibility you'll find it. Else its gone , sorry.
Please check in your project folder. you might have removed only its references, search for the file name and add it to your project .

Delete by mistake the storyboard

I delete the storyboard by mistake from my app.
Where I can find it and restore it,
or I lost it?
The default storyboard filename is Main.storyboard, so that's what you should look for unless you gave it a different name. (Older versions named it MainStoryboard.storyboard, so if you are working on an older project, you might need to look for that instead.)
First, check your project folder (using the Finder). If it's there, you can drag it back into your project in Xcode, or you can use the “Add Files to …” menu option.
If it's not there, check the trash can. If it's there, you can right-click it and choose “Put Back”, then follow the steps in the previous paragraph.
Try running again your app and Xcode will create the file automatically, this worked for me.

Unknown class FirstViewController in Interface Builder file

When I run my application i got this
I see in my console this message "Unknown class FirstViewController in Interface Builder file."
I am running TabBar application.
How can I fix this?
It looks like you deleted FirstViewController.h & .m from project, but forgot to change view controller's class in nib file.
Go to project , targets , build phases , compile Sources and add the unknown class ..done.
Right click on Storyboard --> Open As --> Source Code
Find your unknown class name in the storyboard source file. It may be because you have accidentally assigned a custom class name for one of your UIView subclass'.
It is kinda hard to understand your comments, but I think you may have deleted the FirstViewController but forgot to change all the references to it. you may need to go to MainWindow.xib and look for all FirstViewController UI components and delete them
Sometimes it happens when you change target name for some reason, you have then to open storyboard as source file, then search for old target name, replace it with the new name, should work if it is the case, hope it helps.
This can also happen if you use the same package name for multiple projects (if you're being lazy with your provisioning). Go into your user directory, then go to Library/Application Support/iPhone Simulator/[your sdk version]/Applications and delete what's in there. You may also have to delete the app from the device. That will remove any accidental references to files from other projects, which can cause this error.
When you add multi project to Workspace. If you use the same Product Name in your's projects. It can conflict.
Rename Product Name in the projects have a same name.
... Hope this help ....
This happened to me just after Git merge and resolving few conflicts.
It had screwed up my XCode project.
I tried all over the StackOverflow. At first I thought my Custom class .m file hasn't been added to the Compile Sources class list. But it's one case, however even after adding it, it gave me same issue back.
How I resolved:
I kept a backup of my .xib file and its backing custom class .m and .h files.
Then clean the project and try to run the app via XCode (which might not work)
Then re-add the files back to the XCode project and it will work.
Cheers!
This can sometimes happen if you made changes to a VC i.e. deleted prototype cell(s) within a tableview.
If all else fails I find cleaning project and restarting Xcode gets things back on track.

XCode uses an .xib not inside the project folder

I went back to an old project and recompiled it for OS 4.1 succesfully and ran it. I was asked to add a fourth tab to the Tab Bar, but I could not set its class to the newly added ModelsVC.h/.m. [edit: because it did not appear in the class dropdown, but the other viewcontrollers were there.]
I moved the project folder to a backup folder and unzipped a months old backup of the same project. It compiles and runs until the end of viewWillAppear for the first (default) view connected to the first tab, and then does nothing more. It is still running, but nothing is shown and nothing happens.
In the console, it says "Unknown class ModelsVC in Interface Builder file."
The problem is, that class didn't exist two months ago, so why should this way old project complain about it or even know about it?
I'd like to know where to look / tell XCode to use the .xib that is inside the project folder it is currently compiling.
And if it's path-related, how do I check what paths XCode looks in when a project is loaded/compiled?
For Xcode to run a .xib file inside the project folder, You can just open your xcode, add existing file and it is there.
I think the problem why the old project still runs is that it builds incrementally. That means when it builds the first time, the .xib file was there, and when it build the second time, it doesn't need to add and build the .xib file any more. So, in the second build, even if you delete and move out the .xib file, I think it still can build
Seems a 'sloppy copy' for whatever reason (such as a quick backup to try something experimental) of a project folder causes confusion. See this.