XCode 14 compile errors immediately disappear or do not appear at all

I'm unable to use XCode 14 to develop my app because as soon as a compiler error is shown, it is immediately withdrawn from the Issue Navigator pane. This makes it impossible to see what is wrong. The errors are also immediately withdrawn from the editor.

This video shows 3 attempts to compile the project: after the first attempt no error shows, after the second attempt the error shows for a moment then is automatically removed (no mouse or keypress from me), after the third attempt same.

https://youtu.be/bmK_k6oLYpQ

I have tried rebooting, and deleting ~/Library/Developer/Xcode/DerivedData, to no effect.

XCode -> Settings -> General -> untick 'Show live issues"

Xcode 14.2 the issue is still there, my team and I are suffering for several months so far.

Preferences -> General -> unchecking "Show live issues" seems to work... but it looks like a workaround other than expected behaviour.

Cleaning Derived Data folder worked for me : Go to Xcode -> Settings -> Locations -> Derived Data -> Click on the right arrow icon Delete the Derived data folder and run again.

A strange solution that worked for me:

  • Checked out a git commit from before the issue arose & injected errors. Confirmed: issue didn't occur
  • Returned to my most recent commit and...the issue was gone?

same problem

Experiencing the same on Xcode 14.2

Facing the same issue with Xcode 14.2, extremely annoying

Having this error on XCode 14.2. Errors not showing on text editor, and only appearing when preview is run. A doctor's stethoscope appears and i can see the error then.

I have kind of a similar issue on XCode 14.2 with warnings. When I clean & build from scratch, I get all the warnings as it should. But after one or 2 rebuild, all warnings in my local packages disappear. I hope it gets fixed in next version of xcode as this renders cleaning warnings especially difficult on large projects ....

Just so this gets bubbled up more this answer colink (Apple wouldn't let me post a direct link ) about mid-way through the comments solved it for me. The tldr; is double check that the groups in your Xcode project have the same capitalization as the folders on disk. Mine had a discrepancy between the root folder name capitalization. Now my errors reliably show. Thank you colink

Also seeing this Xcode 14.2, with a large project I'm working on. I haven't been able to find any group/folder capitalization mismatches though. Clearing derived data folder etc has not worked.

In my case, local frameworks were the problem. The product build does work, but the Xcode index builder couldn't find them.

Here is the sample code. The problems were reproduced with Xcode 14.1 and 14.2. You can find the same problem with the project in the start directory. And the problem was solved with the project in the final directory by specifying the search path of the build settings. (FRAMEWORK_SEARCH_PATHS, LIBRARY_SEARCH_PATHS, and SWIFT_INCLUDE_PATHS were set)

https://github.com/gatherheart/IndexingError

I reported this problem via FA also.

could u plz check the FA threads? (FB11997524, FB11982383)

Here, one more sample project can be reproduced, so please check this as well.

https://github.com/gatherheart/XcodeIndexingError

With this project, Xcode 14 build errors immediately disappear or do not appear at all.

To reproduce the issue, please follow the steps below (based on the sample project "XcodeIndexingError"):

  1. Xcode version should be 14 or later.
  2. Add any xcframework to your project (e.g. SimpleFramework).
  3. Import the xcframework from another file (ImportFramework.swift).
  4. Switch the current build scheme to a configuration other than "Debug".
  5. Select a real device as the build target, not a simulator.
  6. Clean the build.
  7. Check that the framework from step 1 is not copied to the DerivedData > Index.noindex > Build > Products > iphoneos directory (sometimes it is copied to iphonesimulator instead).
  8. With all the previous steps satisfied, open the BuildError.swift file in Xcode and build the project. The build error appears briefly and then disappears within 5 seconds, making it difficult to identify and investigate the problem. This is the issue that needs to be addressed.

Step 7 of the reproduction steps seems to be the critical part, where the framework interface specification that should be copied to iphoneos is being copied to the simulator path. But if I set the simulator as the build target, they are copied to the simulator path every time, so the problem is only on the iphoneos side. After repeated cleanup, it is copied to iphoneos (correctly right path?) on rare occasions and there is no more problem.

What if I copy the interface file of the framework that was not copied from the simulator path to iphoneos? The error message is displayed normally again and does not disappear. I think this is related to the cause of the problem.

Plz check this issue, and I hope this helps.

Thank you.

This worked for me:

  1. Quit Xcode
  2. Goto Storage Management (Search Storage Management on your Mac)
  3. Select Developer on left panel.
  4. Select Project Build Data and Indexes and Delete it.
  5. Open Xcode

The problem is definitely caused by live issues. After your build failed, Xcode does correctly highlight the compiler errors, that's why the often appear for a brief moment. But then live issues triggers builds of the current file in the background to update issues constantly while you are editing it and this kind of background builds fail for some reason and they fail in a way that no compiler errors are available, so all errors disappear as the live issues override the issues from the last build. That's why disabling live issues causes the errors of the last build to be shown but then build errors will only update every time you trigger a build and not while editing a file.

As for why live issues fail, there seem to be a couple of reason:

As one user here pointed out, this can happen if Xcode and filesystem disagree about capitalization (Xcode thinks the folder is named "folder" while in fact it is named "Folder"). HFS/AFS by default don't care for capitalization, to them "folder" and "Folder" are in fact the same folder, yet code and certain APIs sometimes do care, so if there is mismatch, strange things can happen.

Another user reported that this can happen if the dev tools don't have the special access rights that they usually do. Usually they get these rights when you start Xcode first time and install the backend components but apparently these permission can get lost. To restore them you can run

sudo DevToolsSecurity -enable

in Terminal.

The post right above this one suggests, that the issue also happens if live build cannot find frameworks, which would certainly also cause this issue.

Most people experience live build failures because of some issue that only affects the ARM code of Xcode, so running Xcode in Rosetta fixes this issue for them. So far nobody has an idea what the real problem is it that causes ARM code to fail.

So the reasons are very individual but in all cases it is live build is failing in background and Apple does not provide a way to see why it is failing and what might be the problem, which makes it guesswork to fix anything.

XCode 14 compile errors immediately disappear or do not appear at all
 
 
Q