Xcode keeps deleting 2 files - xcode

I have an Xcode project using Xcode 8. I am using Swift if that helps/matters.
A few days ago after really not changing that much except a few funcs in one VC I tried to rerun my app and it had an error (I can't remember what it said unfortunately...but when I google'd it said basically that there was a file missing)
I located what the files were and just copied all changes into a blank project and deleted the file and pulled from Github a clean version and re adde the few funcs I added.
Everything was great and nice, until yesterday I noticed 2 yellow warnings.
I clicked the "Issue Navigator" and it is saying
TestApp project missing file
TestApp.debug.xcconfig is missing
Pods project missing file
pods - TestAPP.debug.xcconfig is missing
I realize that files just don't randomly disappear, but honestly I did not touch anything other than the Storyboard and the one ViewController File I am working on.
Why does Xcode keep deleting my files?
Is this project savable or do I need to start it over (is it corrupt?)
My project also is using Firebase.

xcconfig files are used to separate out build configuration information. Those errors are showing that you're missing entries corresponding to a debug build.
Nothing should be touching them. Only three possibilities come to mind:
You didn't create debug configs in the first place, but have tried to use them somehow.
Your path configurations are placing these in a directory that's getting wiped out when you clean/rebuild your app.
The project directory is under git control and you're doing something with git that removes the files.
Here's a screenshot showing I have two configs under my Pods project, one for "release" and one for "debug".
You might try setting up your project and making sure you see the debug configs listed. If so, see where they're kept and so on to diagnose what's going on. Otherwise, you just haven't created them.

My guess is that the files are not actually missing in any serious way. It's a bug related to use of git (as you say, the files came thru GitHub, so we know the project is tracked thru a git repository). The files were removed, but this is in fact not a problem. If that's right, then, as I explain at https://stackoverflow.com/a/39715083/341994, you can solve this simply by doing a git add or git commit of these files. That will cause Xcode to become happy and the warnings will go away.

Related

Xcode can't find files after relocating some files in the project

After relocating some files in an Xcode Project (moving some files into different folders without editing the files), Xcode can't archive the product anymore. Xcode was able to compile, build and archive the project before I restructured the project.
Now Xcode can compile and build the project but it can't archive the project, saying that it can't find specific files and objects in scope, which are inside the files I relocated.
When I click on the missing objects in the navigator and i'm taken to the object-reference, the error disappears. Only to show up again upon archiving.
It seems like Xcode failed to update the paths of the files upon relocating. How would I be able to manually edit that?
Thanks in advance!
P.S: I use git and GitHub incase that matters.
The problem was fixed by removing all files, and re-adding them from Finder by dragging and dropping them onto the Project Navigator.
I did run across the following issue afterwards:
Xcode 10 Error: Multiple commands produce
Which was easily solved by following the solution in that post.
Credits to #Jokecoder for suggesting the solution.

Why aren't my nib files being created?

I've inherited a objective c application that I don't know much about.
My task was to change the login from a normal form view type thing, to a web view that gets content from a server. This all went fine and is implemented, but things weren't working right in the localized version.
Since there are no strings used, I deleted the localized files and now it seems my nib files don't get created. It's like there is a compiler error that's not reported. I checked the resource files in the build area, and it doesn't create nib files for anything after the login view I changed.
No errors are being reported during the build. I've tried re-starting Xcode, changing the branch in git to something without these changes. Nothing seems to clear up the issue.
For anyone else that comes across something like this. What finally worked for me was completely re-cloning the project from git. It appears that some of the files in the project were not tracked and just stayed around when I changed branches. I'm not sure if this is config related file, which we commonly don't track. All I know is that re-cloning fixed the issue.
In researching the problem, other common fixes include deleting and recreating offending xib files. Simply restarting Xcode. And, deleting a variety of other project related files and directories.
Hope this helps someone.

Remove submodule repository from Xcode source control

I had 2 submodules which I deleted recently. Removed them from .gitmodules, removed them from project directory, removed them from .git/modules. But Xcode still thinks that they're existing in Source Control. So I noticed an xccheckout file that contains the remotes. I googled about half of hour how to actually remove them, and found a single f...g instruction to remove them manually from xccheckout, others are about how to remove Git support from project (which isn't actually what I f...g need) or questions about should I put xccheckout into .gitignore or not.
Am I doing something wrong? Isn't there any way to remove the submodule link from Xcode project with actually the program created it? Am I the only who needs this?

Xcode fails without specifying and errors

All of a sudden my project fails to build in Xcode. If I look at the log I see all the needed dependencies being built, and then I get a strange error:
Verify final result code for the complete build operation
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
I removed my code directory and replaced it with a backup, did a clean, tried building all the other components separately (they succeed) - nothing works. I tried a command line build, same issue.
There were only a few hits on google for this error, none offered any useful advice.
Can anyone please help?
Update: When I run the command line build, I see the following error:
2012-05-25 08:55:53.830 xcodebuild[3358:4203] No recorder, buildTask: <Xcode3BuildTask: 0x400f35e60:'ProcessPCH MyProject-Prefix.pch':REfc(32370056113422336):deps=0:phaseNum=4>
I checked the output of xcodebuild and it is returning '65'.
I thought there might be a problem with the MyProject-Previx.pch file, so I shut off "Precompile Prefix Header", and now I get the same error with a different file:
2012-05-25 09:15:11.784 xcodebuild[3882:3703] No recorder, buildTask: <Xcode3BuildTask: 0x40048ab60:'CompileC HelperRoutines.m':REfc(33777199068741632):deps=0:phaseNum=4>
Build operation failed without specifying any errors. Individual build
tasks may have failed for unknown reasons. One possible cause is if
there are too many (possibly zombie) processes; in this case,
rebooting may fix the problem. Some individual build task failures (up
to 12) may be listed below.
I've run into this problem consistently recently while running Xcode 9.0 Beta 3 and Xcode 8.3.3.
The fix is to delete ALL in the Derived Data folder. It then seems to work again.
rm -rf ~/Library/Developer/Xcode/DerivedData
NOTE: just cleaning the build or deleting the current build folder for a project does not seem to help.
Hope this helps :)
I was hitting this error and it infuriated me for an hour or so. The answer below helped me out a lot: essentially your machine has a ton of running processes, XCode can't handle it, and rebooting your machine is the best answer.
https://stackoverflow.com/a/13183522/1863655
I looked around for a bit and the only one that worked for me was shortening my project folder name.
All other tries: restarting, recloning, deleting derived data, etc. didn't work. The only thing that worked was making the project folder name shorter.
I also encountered same error. I was edited .pch (Prefix Header) file. Then I started getting this strange error.
Then I removed all editions which I made in .PCH.
Then I quit my Xcode.
When I restarted Xcode this strange error was gone.
Hope this will work for you also.
Best luck Buddy (y)
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
This happens occur when the total path length is too long.
change the folder name or location of directory, shorter then before.
Happy 2019, everyone, but sad to say this can still happen in Xcode 10.2.
I had four projects open in Xcode but only one failed in this way. I tried a main menu > Product > Clean Build Folder. The little progress spinner started up and 5 minutes later was still spinning. Hmmmm.
So I quit Xcode and in Terminal did a cd ~/Library/Developer/Xcode/DerivedData. Although ls -alww showed only one subfolder named after each of my other projects, as expected, there were five subfolders whose name began with the name of the problem project. I deleted all of them
rm -R ProblemProjectName-*
and relaunched Xcode. Problem solved.
Mine gave this error sometimes, also LLVM failed with exit code 1 and clang failed with exit code 255, at different code locations each time. I just had to reboot (OS X 10.7, Xcode 4.5).
I rebooted, no luck. Then I noticed that when I relaunched XCode, one of my tabs was loaded with no file in it. I figured out what file I was editing in it, opened it, saved it and then I was able to build.
None of these answers worked for me on XCode 5.
Luckily, I'm still only testing XCode 5 - I kept XCode 4 around.
XCode 5 simply won't build one of my two projects, claiming that my libraries aren't built with the right settings, and I keep running into the error described on this page on the other one... so I'm sticking with XCode 4, which builds both of my projects perfectly well.
If you are experiencing this issue on XCode 5, consider "reverting to XCode 4" as another strategy.
Overall the idea that repeatedly running a program, XCode or not, degrades your system to the point where you have to reboot does not fill me with confidence in that program.
With Xcode 5.0.0, this error was caused after an update to the CLI tools.
Updating to Xcode 5.0.1 and installing all the required components again still didn't fix the error. However, 5.0.1 was kind enough to actually emit an error that was useful.
/bin/mkdir -p /Users/xxx/Documents/XCode/SampleApp/bin/SampleAppDebug.app/Contents
error: (null)
This lead me to look at the bin folder, and find out that the 5.0.0 build with broken CLI tools had made a symlink in bin/ to the derived information folder with SampleAppDebug.app, which for some reason it could not write to.
I manually removed all contents of the bin/ folder and rebuilt without errors.
I faced same problem. I have change my System time.I delete file "/Users/YOURNAME/Library/Developer/Xcode/DerivedData/ModuleCache/YOURBUNDLEID/UIKit.pcm". Then it's work fine for me. Try this.
I added into the Framework search paths the header file location.... removing this from the top level project settings fixed the issue for me.
Change at your peril.
The only workaround, that works for me - push your code to git repo and clone it to new location.
I highly recommend to reclone your repo, because you'll deal with some random problems if you prefer rebooting/turning off and onXcode.
did you set "Perform Single-Object Prelink" to Yes?
try turn it off.
i had the similar problem. i have tons of files in a static library. reducing the number of files or setting "Perform Single-Object Prelink" to NO solved my problem.
Same error and following didn't work for me for Xcode 6.3.2 on Mac OS X Yosemite 10.10.3:
Git discarded changes to last successful build point
Creation of new fresh project from scratch from a builtin template (though I cannot recall whether it built successfully or not)
Restart of Xcode
System Reboot
and the following worked:
I faced the problem in the morning and it got resolved in the evening with a couple of Xcode restarts and System reboots and creation of new project. So, I'm not sure what really triggered.
I faced the same problem today. Cleaning the DerivedData and cloning the project somewhere else didn't help. What fixed my problem was repairing the volume from the Disk Utility app and removal of all Xcode plugins.
I have encountered same issue without having any code changes for my project running on Xcode 9.2. It looks like if you have some run scripts or external build systems attached to the project, this might cause an issue. Try committing or discarding changes and build again. If it still persist, delete local repo and clone again. Also maintain smaller folder names for project location.
Same issue when added watchOS target inside iOS app, using Xcode 11.1 with SwiftUI:
Go to menu Xcode / Preferences / Locations
Open Derived Data folder in Finder clicking on the arrow next to /Users/yourUserName/Library/Developer/Xcode/DerivedData
Locate your app Derived Data folder and delete it
Menu Product / Clean Build Folder
You should be able to compile again.
I know this is super late to answer but I'm answering since none of the above solutions worked.
For me restarting, clean building, deleting derived data nothing worked.
Because the issue was not due to any zombie objects or something like that.
I'm using Xcode 11. I think it's an Xcode bug that sometimes errors are not shown in the issue navigator. But don't worry check the build report in Report navigator(The last tab in project navigator: the one that looks like a comment box with lines in it. or simply cmd + 9).
Click the relevant build and resolve the issue, mine was missing file in pods directory.
just try to rename the folder name of the project. it did the trick for me
I had this same problem, however the accepted solution did not work for me, what worked was:
deleting .workspace file
deleting Podfile.lock file
deleting the Pods folder
pod deintegrate ; pod install
For me it was fixed by changing to the new build system(in File -> Project settings)
I have Xcode 11.7

Delete an unreferenced image from repository in Xcode

I deleted default.png from my resources folder because I wanted a different image for the loading screen, but I just deleted the reference which was apparently a dumb thing to do. I dragged the new image into resources and tried to change the name to Default.png, but it won't let me, which I think is because the first Default.png is still in the repository somewhere. Anyway, how do I delete that image(and others with which I have probably done the same thing) from the repository when it is no longer visible in xcode?
What kind of repository is it? Subversion? Git?
The SCM integration in Xcode is great for checking out files and committing changes without having to leave the IDE, but it's hardly a full-blown GUI front end to either svn or git. It may be possible to fix your mistake by adding the file back to the project and then deleting it in Xcode in such a way that Xcode will remove it from the repository for you, but the simple solution is to just delete the file from the repository yourself by using the appropriate version control command. For example, if you're using Subversion you could:
svn remove default.png
to remove the file from your version of the repository. When you commit your changes, the file will be deleted in that version. (It'll still exist in previous versions -- that's the whole point of SCM, after all.)
After that, you can create the new file and add it to both the project and the repository in the usual way.
You need to manually go into your app's file structure and delete the image files themselves. Also, it is usually a good idea to "clean" the app whenever you remove files or references to files from an XCode project, since XCode can be a bit temperamental about removing files; the key combination for this is
Hope this fixes your problem.
Clean all targets should work (at least it worked for me). You can try the following:
a) delete the reference from "Copy Bundle resources" of your target
b) delete the app from Simulator/Device
c) clean all targets
Caleb is absolutely right. That fixed the problem here as well for the most files.
An easier way to get an overview of the accidentally un-deleted files, is creating a bookmark of the working copy with Versions (SVN Software - in case you use SVN). There you can detect the problematic files grafically and delete them. I always have to do this after restructuring the project folder.

Resources