Xcode showing numerous unrelated errors, only in the issue navigator - xcode

Xcode has started to show 40+ errors in the issue navigator. The number of error's varies between 40 and 70 each time try to run my app in the simulator. There are always 2 errors to each file. When i click on an error nothing appears within the code and the 2 errors for that file disappear from the issue navigator.
All of the errors are for one of two things
Cannot convert return expression of type '()' to return type 'UICollectionReusableView'
or Cannot convert return expression of type '()' to return type 'UICollectionViewCell?'
The errors are only shown within the side panel and not in the code. I know this is an error with Xcode as I had successfully run my app all afternoon and changed a few lines in 1 file. Now errors are shown in 20+ files and they're not related to the collection view items in the error description.
I've deleted derived data, cleaned the Xcode project, restarted Xcode and restarted the whole laptop but nothing is working.
My next resort will be reinstalling Xcode but surely that shouldnt need to be the solution.
I'm running Xcode 14.2 on Montery 12.6 on 2021 M1 Macbook Pro.

Related

Why does Xcode 10 Crash?

I am trying to open a project that I created using Xcode 9 with Xcode 10 which I just downloaded yesterday. When I open the project Xcode crashes every time. I am able to create new projects and open others, but this one particular project crashes Xcode every time, regardless of the way I try to open it.
In researching this issue I have done the following in an effort to resolve the problem:
Rebooted √
Reinstall Xcode √
Delete the DerivedData folder √
The error message in the Xcode quite unexpectedly popup says:
UNCAUGHT EXCEPTION (NSGenericException): The window has been marked as
needing another Layout Window pass, but it has already had more Layout
Window passes than there are views in the window.
One other clue, that may or may not be related. I searched through the system log and came across this which was recorded at the same time as the crash:
Failed to bootstrap path: path =
/Applications/Xcode.app/Contents/XPCServices/com.apple.dt.Xcode.SymbolicateXPCService.xpc,
error = 129: The service was superseded by a later version
I have put a lot of work into this project and would really like to be able to save it. Thanks.
Per Matt's suggestion, I downloaded Xcode 9.4 and was able to open the problematic project. It opened and I was able to build and run the project. I then closed it out and opened Xcode 10. I was then able to open the project, update it to Swift 4.2 and then build and run the project. Problem solved.

XCode does not auto compile anymore after project get's bigger

In the beginning when I create a new project, XCode will see errors as I type and tries to correct me. However, when my project gets bigger, XCode will not auto compile anymore. Anytime I hit the build button, the errors will come up. I want to see the errors as I type. I got a macbook pro 2017 and XCode 9.2. These are my settings:
Trying to clean the derived data etc will not work

Storyboard won't open in XCode8

I have a storyboard that opens fine in XCode7.3.1 but in XCode 8 will only open source code, it will not open in Interface Builder. Trying to open it in Interface Builder produces the error: The document "Main.Storyboard" could not be opened. Unrecognized file content.
Got a similar problem, although I had a never ending spinwheel, didn't even get an error message.
When I noticed not a single file of my project was changed when it stopped working I assumed a cache error somewhere, so in the end I 'fixed' it by restarting my computer (restarting XCode wasn't enough).
The joys of a .0 XCode version

XCode 4 osx 10.9 - folding methods crashes

After updating to osx 10.9, in any of my projects doing the following crashes Xcode 4.6.3:
fold a method, if statement, for loop, etc
click on a different file
click back on the file with the folded code
When clicking back on the file I notice that all the line numbers are gone but the one at the very top (which is usually some random number and it sort of flashes a bit). Less than 5 seconds after clicking on this file XCode crashes.
This is repeatable. When I reopen Xcode and open the project, the problem persists. Now I am unable to access that file. I've tried closing Xcode and releasing the memory in RAM. I've tried removing the reference in the project and adding it back. Yes the problem persists.
This is massively frustrating and has completely derailed my development. Has anyone else had this issue? Anyone know how to solve it?
Here's the crash report if it's helpful.
-GW
Ok I figured it out, but am still curious as to why this is happening and how I can still fold my code without this problem.
click on the problem file.
click anywhere where the code should be (sometimes all the code appears to be gone)
goto Editor > Code Folding > Unfold All
That cleared it up.
It happened to me too. I fully share frustration and reasons why not going to rev 5.
Here's my solution :
exit xcode
go to your myProject.xcodeproj file
look inside the package for myProject.xcworkspace file (right click / Show Content)
back up myProject.xcworkspace outside your xcode hierarchy
delete myProject.xcworkspace file
restart xcode (a clean myProject.xcworkspace will be created).
NOTE: Works for me, but I'm not using workspaces. I have not tried, but I suppose that if you want to preserve your workspace settings you'd have to selectively delete the UserInterfaceState.xcuserstate files further down in the package hierarchy?
I had to delete UserInterfaceState.xcuserstate file to solve these reoccurring code/comments folding crashes in Xcode 4.6.3 running on OSX 10.9.
This file can be found at projName.xcodeproj(Show Package Contents)->project.xcworkspace(Show Package Contents)->xcuserdata->username.xcuserdatad->UserInterfaceState.xcuserstate
Note that you will loose all the saved user state info of your project, which means all your open tabs will disappear, folded code will be unfolded etc. And the crashes may start reoccuring if you fold any code or comment again.

Storyboard Internal Inconsistencies

I have a similar situation explain on this thread (XCode 5 Storyboard Internal Inconsistencies), but I installed the final version of the Xcode and never installed any beta version. Additionally, I can't add comments in previous thread cause I don't have enough points. So i need to ask my specific case.
In XCode 5, I have a problem with all of my projects "The document 'main.storyboard' has X internal inconsistencies that were found and repaired. Please save this document to fix the inconsistencies."
If you choose to list the inconsistencies, you see that it's saying that some Images in my resources section, that uses this image, and is duplicating in the Storyboard. I try to save the document, but it does nothing, and when I relaunch the project, I get the same error.
I try all this things with NO SUCCESS:
I delete all duplicates in storyboardFile file.
Drop the image file from my project and add again.
Reconnect UIButtons with the problem image.
Change the image name file.
In my research, also I create a new project in XCode 5, add a same image in two objects inside Storyboard and got the same message.
Anyone have the similar problem?, and more important, anyone have a solution?
I have XCode 5 and OSX 10.8.5.
**** UPDATE *****
I found a workaround. The error is generated when one image inside the storyboard is used several times, if you delete the reference of the image and assign the image to the object by code, the error disappears, but I don't like it. I'll research a little more, but apparently is a bug from Xcode (I hope not).
This problem occurred for me Xcode 10.1 but was resolved. The error message provided a "Show Details" button.
Clicking on Show Details showed my problem, a duplicate.
Right-clicked on the identified storyboard (Main.storyboard) to open as source code.
Searched for the duplicate declarations and removed one of the duplicates.
The error message no longer occurs including when the storyboard is reopened.
An easy way to fix this problem is to open up the Storyboard in TextEdit, then go down to the resources section at the end and delete any duplicate entries for images you see. They're sorted alphabetically, so it's fairly simple to do.
Saved the file, loaded up XCode and no more error messages.
I upgraded to Xcode 5 last night and am experiencing multiple issues, including the one you described above. I also seem to have found a workaround, albeit different from the one you found.
To get rid of it I saved the project, closed it, opened a different project and ran it in the simulator, quit Xcode then reloaded the original project.
Error message no longer appeared.
I have no idea why but this seems to have solved it for me.
Now to tackle the other niggles......... :-/
Same error today after upgrading to Xcode 5: internal inconsistencies relating to images that are used more than once in storyboard, but I found a solution that worked for me here: https://devforums.apple.com/message/883402#883402.
I created a new Asset Catalog (New file / choose "Resource" / Asset Catalog).
Once created, I selected the option 'Import from project' and imported all my images. Seems to have done the trick.
After installing Mavericks and Xcode 5.0.1 the problem was fixed.
Try to find under inferredMetricsTieBreakers section at the end of the storyboard unused segue references in the whole document as in the photo

Resources