Xcode 4.2 (Snow Leopard) Build Warning "Missing File" - ios

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!

Related

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.

How do i fix this CopyPNG File error?

While reading /Users/user/Desktop/AppProject/PruebaApp/Logo Retina.png
pngcrush caught libpng error:
Read Er Could not find file:
/Users/user/Library/Developer/Xcode/DerivedData/PruebaApp-cblepoaxbqzyopcbcswwqjtftyon/Build/Intermediates/ArchiveIntermediates/MaderoAPP/InstallationBuildProductsLocation/Applications/MaderoAPP.app/Logo
Retina.png
Command
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng
emitted errors but did not return a nonzero exit code to indicate
failure
Im getting these errors while archiving project, at the end it does archive but i want to get rid of it. I had trouble with the app before and i read that i should delete the DerivedData/(myproject)folder so i did. and apparently it is trying to look for the images in that folder how do i fix this??? Help!
Try first by Hard Cleaning your project CMD+OPTION+SHIFT+K, If problem exists apply following method,
Build Phases -> Copy Bundle Resources, Any fileName is red color?
Or
Convert Logo Retina.png or Create it again, maybe it's an encoding\format issue.
Or
Rename "Logo Retina.png" to "LogoRetina.png".
~Good luck~
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build
Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
Just compile your code. You are good to go.
Hope it works for you.
Just open image in Preview app and export it as png file. Replace old image with new in Xcode.
Honestly I have had this problem intermittantly many times and clean then rebuild has fixed it.
Since the answers here are either not useful at all or quite complicated I want to add mine:
The error means that Xcode can not find the file, whether it is in the project's folder or not.
If you still need that image, what you can do is to open a Finder view and navigate to your project. Drag the file Xcode was complaining about into the project an uncheck 'Copy to folder'.
if you do not need the file anymore, on the left side of Xcode, find the file, it will be shown in red, simply tap on it and then delete / backspace
Hope that helps some people :)
To solve the issue copy the Image name. Then Filter it (Build Phases -> Filter textfield). Finally I removed it.
Also check that you are not naming the images with only a number like "0.png" I change it to "tuts0.png" and it worked.
I just had this error and honestly I think it was being caused by another error. I had an issue with my Crashlytics framework and I'm convinced it was effect some unassociated pngs with the copypng error. I replaced the Crashlytics.framework with a fresh version and viola, all errors were gone.
Don't ask me how this works, I'm just posting this in case someone else can benefit from it.
I wasn't able to fix this problem. So i delete and reinstalled xcode, this helped for me.
Fixed it by reverting to my old product name (in "Build settings"). Seems that the new product name confused the images path.
I have the same issue with resources. The problem was that I have copied target from another one and just forget to uncheck checkbox at target membership window.
i face this problem and this solution is working form me
you need to remove any reference for that image
Build Phases -> Copy Bundle Resources
after that clean and build and problem will be fixed
I had accidentally deleted the file from the location which was linked to x-code project. I had not copied the file in my xcode project but just the path. Hope it helps someone.
I've had similar issues with pngcrush /libpng crashing with PNGs (checksum errors / freeing object that have been freed etc). These could be reproduced on the command line so I recreated the PNGs, even converted them to other formats then back but the errors persisted. In my case Xcode then rejected the resulting archive for not having iPhone 5 support (as pngcrush killed the Default-568h#2x.png image). The above fix resolved this.
For those who are struggling with this error while building Cordova app.
Please keep the following point in consideration as it may lead to this error.
The images should be tagged as "resource-file" and not as "source-file" in plugin.xml of your Cordova plugin as the former includes the images in "Copy Bundle Resources" (under Build Phase) and the latter to "Compile Sources" of your equivalent xcode project of cordova app.
If non of above answers can fix your problem, try look into Xcode project where you reference your image file, I happened to referenced twice to the same png file. Once I delete one the reference, it worked. The error went away. Good luck.
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
clean cmd+option+shift+k and Build Project...
work well for me....

Duplicate files in Xcode manager?

I've found that I get duplicate files in the Xcode manager. They appear to point the same file in finder. My first thought is that this was created when one of my colleges was, incorrectly, fixing a conflict in the source control. I'm not sure how to fix the problem. When I try simply deleting a duplicate Xcode crashes. I've filed this buy with apple. However I would like to remedy this problem in the meantime.
Thank You.
I don't see any duplicates in your list. Every class comes with a .h and a .m file (there are exceptions). Long story short, there's not a problem with the image you posted.
Select one of the CMPortfolio.h files and one of the CMPortfolio.m files (one of the references, rather) and press the delete key. When asked whether you want to remove the references or actually move the files to the Trash, choose Remove References. This should remove the duplicate references while not touching the actual files on disk (which allows the remaining reference to each file to be valid).
I had the same problem. That helped me: I moved all duplicated files in some other folder in Finder -> all files in project were red. Then I simply deleted the files from project, copied the files in the project folder and added them to project again.

Xcode weird random error that doesn't go away

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.

How to remove reference of file Xcode?

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!

Resources