I have a regular project i'm working on for a while -
I've edited the plist file, which caused some problem, so i've reverted to the old plist file (where all used to work), but the following errors always show and dont go away,
I've tried cleaning the project (Cmd+Shift+k , Cmd+Opt+Shift+k) , Tried resetting my pbjprox, tried clearing ~/Library/Developer/Xcode/DerivedData/ and /var/folders
Nothing works, and i guess the errors are cached somewhere that i can't think of...
Would appreciate your hints about this
Shai
This is easy to fix - your files are not on location where Xcode expects them. Just delete the file from your project and add it again.
If this doesn't work, it can be a collision with your versioning system - see Missing file warnings showing up after upgrade to XCode 4
I would copy these files into another location (outside the project folder) and then remove them from the project and add them back (Add Files to ...). Make sure to select Copy Items into destinations group's folder
Sounds like Xcode is a little confused about the association of these files to your project.
Related
I've been working on an Xcode project on my desktop, and I was trying to save it to GitHub, so I could access it on the road. I've saved it to GitHub before, without issues, and the local Desktop version was working fine. After saving it to GitHub, I tried downloading it on the laptop, to make sure everything was fine, and one file was in red. It doesn't look like it was saved or even exists. I get a "Build Input File can't be found" error.
I went back to the Desktop version - that file is there and everything works. I thought, maybe I messed up with GitHub, so I tried to save it to iCloud, and then emailed myself a zip copy - same thing. Every other version, but the desktop version, had that one missing file in red.
I've looked at other posts for those with similar problems, and all the answers seem to say the same thing - the file was moved or deleted; however, it is still there on my original desktop working version. Any thoughts as to what is going on or what I should do are welcome.
I'm working on XCode 13.1, on a Mac running iOS 12.1
Follow up - locked files:
As some of you suggested, the file could be locked. It didn't appear so, and I thought it unlikely, as I don't know how to lock them. I copied the one file over, added it, and it is running, however, I got this warning when I tried to save and close it:
Locked file warning
I went through the steps to unlock it, and curiously, finder says it is not unlocked. Not locked but I'm getting the warning
Everyone has permission too
Any ideas as to why this might be? I'm stumped. I did try locking and then unlocking it, but no dice. I still get the error I don't have permission because it is a locked file.
Probably the file is not inside the project folder. This can easily happen with resources such as images and sound files that you copy to the project navigator. The project works fine but it has an external reference to the file. If the project folder is copied, eg zipped, the file is missing because it was not part of what was copied.
This generally occurs when you moved or deleted that file within Finder.
So try to delete that file from your project in Xcode and then re-add that file to your project folder in Xcode. Then your file would be working fine.
first: get your file from the current full path and cony it to any location on your mac enter image description here
Second: delete the red file from Xcode
third: drag file from the new location to Xcode don't forget to check on copy if you needed :)
DerivedData keeps returning into my project no matter how many different ways I try to delete it. This is causing a compile error.
I believe it is related to my deletion of my Core Data model class and extension (I realized I needed to add an additional property and this seemed easier than migrating since I hadn't actually implemented it yet). I deleted the files and removed the reference to these files, but that seems to have not worked. This is the error I've received:
I have tried:
-Cleaning
-Cleaning Build Folder
-Resetting Simulator Content and Settings
-Removing the DerivedData folder using "git rm -rf --cached ."
-Deleting DerivedData folder using Finder, Xcode and Terminal
-Deleting the Module Cache
-Deleting Xcode preferences (defaults delete com.apple.dt.Xcode)
-All of the above combined with quitting Xcode and/or restarting my computer
-Following all suggestions in the following threads on SO:
Xcode 6 Swift code completion not working
How can I delete derived data in Xcode 8?
Xcode keeps remaking derived data folder after I delete it
https://forums.developer.apple.com/thread/81265
https://iosdevcenters.blogspot.com/2015/12/how-to-delete-derived-data-and-clean.html
For the sheer hilariousness of it all, I have my project folder open in Finder when I try to run the project and can see the DerivedData folder being created as soon as I press the play button. Good times.
This is a view of my build/compile settings in Xcode to show that I don't have those files listed twice:
How can I fix this?
The error suggests that you have Core Data code generation turned on and also have a copy of the generated code (or at least a file with the same name) in your source code repository. That's why it complains of a duplicate. One is located in your Model folder, and the generated copy is located in derived data.
You can resolve this by either
Changing the setting in your data model so that Core Data doesn't generate code for this entity anymore, or
Deleting your copy and letting Core Data do its thing.
Either is valid and should work. Or, if the files are actually different in some meaningful way, rename yours so that the name doesn't conflict.
On a related note, the derived data folder always comes back because that's where Xcode puts all of the stuff it generates while compiling your project. It's not just generated source code, it's also things like compiled object code files and eventually the app itself. It comes back because that's how Xcode compiles the project.
You can't prevent Xcode from generating derived data for your project. No matter how many times you delete the folder, it will always regenerate.
I've come across similar issues in the past where the compile time error points to derived data, but something else is causing the issue.
From the looks of it, some of your files are being included twice in your project, and your getting name collisions. Check that you don't have duplicates in you build settings for bundled/compiled resources.
I am using the DropboxSDK.framework in a project of mine.
I have everything setup and working fine. However, every time I quite Xcode and open it again at a later point I get the error below:
Which is weird because I can see that the framework is in the project and nothing (that I know of) has changed since the last time I had the project open and working.
The way I make the error go away is to:
Right click on the DropboxSDK.framework in my project --> Delete --> Remove Reference.
In my project's Build Settings under Search Paths I remove the path that is under Framework Search Paths (the highlighted selection in the image below).
Then I clean my project SHIFT + CMD + K
Lastly, I click File --> Add files to my project, navigate to the DropboxSDK.framework file which I previously removed reference to and add it back to my project.
Then I build my project again and the error goes away and will remain gone until I quite Xcode and open it again.
Has anyone else ever encountered this happening and fixed it?
Or have any suggestions I could try to fix it? I'm using Xcode V5.1.1
Let me know if there's anything I can clarify. Thank you!
$(SRCROOT)/Application_Folder
Application_Folder is the name of the folder where your whole code other resources resides
Insert above line in Header Search Paths
I had a random thought sparked by Indrajeet's answer that solved my problem.
When a new project is created in Xcode a project folder is created. In that folder there is another folder with the same name as your project, a .xcodeproj file with your project's name and a yourProjectNameTests folder.
Visually like this.
Application_Name --> Application_Name
Application_Name.xcodeproj
Application_NameTests
When I was having the error I described above the DropboxSDK.framework and it's accompanying files were stored here in this folder:
After removing all references to the DropboxSDK.framework in my project I decided to move the DropboxSDK.framwork and it's accompanying files one folder level up to the main Application_Name folder here:
Once I did this, I clicked File --> Add files to my project, navigated to the DropboxSDK.framework file, now one folder level up and added it to my project.
After building no error was thrown. I restarted Xcode and tried again to make sure; still no error. Rebooted my computer to be truly sure... still no error!
I was having the sane problem and just found the answer by chance!
It happens when you create your project name with SPACES between the letters. Somehow it makes XCode crazy when searching for the frameworks.
So if want to create a project called "This is My Project Name", call it "This_is_My_Project_Name" and the frameworks will be found every time. It worked with me.
I recently deleted a viewcontroller from my project (both .h and .m files) but know I get a 'missing file' warning every time I build.
Any ideas on this and is it something I need to worry about?
Appreciated
This is probably a version control issue if you are using svn or git. I had this problem and solved it using the solution provided in this post:
Missing file warnings showing up after upgrade to XCode 4
I recently faced the same scenario. Adding and deleting did not work for me.
However, I added them once more and right clicked on them. Under source control, I Discarded the changes and then deleted the files(Move to trash). This worked for me !!!
Ensure that it's not referenced anywhere in the project.
Look at the files on the bar on the left, make sure it's not there. Missing files are colored in red.
Ensure that none of your files #import the file.
Also, in the future, avoid storing files in parent directories. ../../ isn't something you want to use.
You likely have a 'dangling reference' in your target's list of files to compile or copy -- check your compile and copy phases for the target which emits the warning.
If it's been physically deleted, the simplest way is usually to enter the file name into the project navigator's search field - look for what Tom detailed - then delete the files from the project(s).
I had a similiar problem. I was trying to delete a .h and .m and I wanted to remove the files entirely, but kept getting errors if I chose "Move to Trash" instead of just "Remove Reference".
Turns out, I needed to just delete each file INDIVIDUALLY. Just add the files back in (if you have them somewhere) and re-delete them one at a time. Worked for me!
I had removed some files from my iOS project a while back and thought they had been completely deleted. After a long time I created another class which unfortunately had the same name as one of those that I had removed from my project (but the reference nor the file had been removed).
To make the long story short, my project tried using the reference to the old file, so I went through finder to delete the conflicting files. That solved the issue of which class was being reference. But the reference to the deleted files cause a warning in Xcode giving me a Missing File message.
Does anyone know how I can remove the old references in order to get rid of this warning?
Since the reference to those files needed to be removed, I tried creating the files again under the same name as those that I had removed manually and deleted them again through Xcode and selected remove references from the pop up.
After removing a subproject, the framework was always referenced in my code.
To remove this framework I had to do these steps:
remove subproject (reference)
clean project
close xcode
remove all derived and cached data with this script run in applescript tool :
tell application "Terminal"
do script "rm -frd ~/Library/Developer/Xcode/DerivedData/*"
do script "rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"
end tell
In my case, adding and removing the external frameworks and using Clean did not solve the problem. Going to Target > Build Settings > Search paths and removing the offending paths from Framework Search Paths and Library Search Paths did the trick.
I hit the same issue today. Due to git merge issue, I ended up with a image file removed, but reference to it still exists. To clarify, My intention was to remove the image.
The simple way to fix this would be using vim, or other text editors
vim PATH_TO_PROJECT/{#projectName}.xcodeproj/project.pbxproj
and do a search on the name of the file you deleted and just delete all search results there.
Go to Project > Build Phases > Compile Resources and select referenced Class and hit "-" .this Will delete reference And now Build Again.
To be safe from this error, make sure you Remove Reference on the file first before making any changes (outside XCode) on that file like deleting in folder, renaming, etc..
To remove reference, in XCode, right click on the file then Delete. A pop-up will show asking if you want to move to trash or remove reference.
However, that popup won't show if you made any changes before doing Delete on XCode.
Just a tip!