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.

  • Did you try to suppress the warning about iOS 9 which is no more supported. Set the deployment target to iOS 11 , then try again. You can also have some information in the build log.

  • In my case project min level is iOS 12 so that's not it

  • Facing same issue, Seems Apple not having UAT team at all for Xcode, Always full of bug

Replies

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.

  • UPDATE!! I found an instance of group/folder name case mismatch. After fixing the spelling difference, I deleted Derived Data and restarted Xcode and the problem seems to have gone away!

  • Update: I found an instance of folder/group case mismatch in my project, and fixing it worked (after clearing Derived Data and restarting Xcode). But today, the problem is back :(

Add a Comment

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)

  • Unfortunately this does not help with my project because the frameworks are being included with Swift Package Manager.

Add a Comment

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.

  • I have exactly the same issue with 14.2. Very enjoying.

Add a Comment

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

  • Thank you! This fixed the problem for me also! I'd encountered this problem in the past, and have fixed it a different way last time, but couldn't find that other thread/forum... It was something in the settings, to do with live error showing or cloud stuff, can't remember for the life of me =( But this solution also worked!

  • Upd: The problem came back, and I managed to find the fix: it is to do with "live issues" in xcode settings->General!! Uncheck it and everything works fine. https://stackoverflow.com/questions/73808435/xcode-errors-disappear

Add a Comment

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.

Okay, I figured out what the problem was. Finally!

The key to figuring that out was to see how Xcode is actually calling clang/swiftc in the background, so you can call it yourself with exactly the same arguments and get the actual error message.

To get that information, you start Xcode in Terminal with sourcekit logging enabled

SOURCEKIT_LOGGING=3 /<path-to-xcode>/Xcode.app/Contents/MacOS/Xcode 2>xcode.txt

After you edited a source file, you can quit Xcode again and now the file xcode.txt contains the sourcekit log. When you search for the file you just edited, you will stumble upon an entry that shows how the compiler was called in the background

  key.compilerargs: [
    "-x",
    "objective-c",
    "-ivfsoverlay",
:

All you need to do is converting that into a command line call by removing the comas and making all arguments a single line, then you can call the compiler yourself with the exact same arguments and it will tell you what the issue is.

More details about all this can be found here: https://stackoverflow.com/a/75605312/15809

In my case it turned out that a module has not been found by the compiler because the "Supported Destinations" (General tab for a framework target) were not correct. During a full build that played no role as the framework was still built for all the destinations and the linker would then find the module file in the build target location which is added to the search paths. But when creating the command line arguments for live issues, Xcode relies on this information correctly reflecting platform dependencies and if the current platform is not listed there, the module map of the framework is not added to the arguments and then the module is not found.

I think it's really a pity that Xcode is not showing these kind of errors by default somewhere in the UI. If you use Visual Studio Code, which uses the same mechanism as Xcode to lint source code and it runs into a similar problem, it will show you the actual error message in its error console and you will know at once what needs to be done to fix that.

Having the same problem in a project that I'm supposed to update to be allowed on app store, so lots of warnings that appear, then disappear again just as I go to check them out. It's crazy-making. I tried deleting build data, caches and everything suggested here. Also deleted and reinstalled XCode and all dependencies to no avail. Finally downloaded the latest 14.3 beta 2, and the bug hasn't been fixed. This shouldn't be happening after bug was first reported 5 months ago!

This worked for me indexing was getting stuck, which caused compile errors to disappear https://stackoverflow.com/questions/13831559/xcode-stuck-on-indexing

FIXED !

At least for me.

I just had this same problem come up, with the errors not showing while editing, and then showing up for some number of seconds after attempted build and then disappearing. M1 Mac mini, all the latest software as of today 28 Mar 2023. I discovered it was only the project I was working on. Opening another project worked fine. I started a new project and copied all the text from the files in the problem project over. All good now.

I'm too new at this to know how to mark this as a solution to help others. Maybe someone has a moment to school me a little.