Xcode errors not identifying the line of code with the issue - swift

I am having trouble with Xcode and identifying the source of the error. It will flag an error, but no longer identifies the specific line of code that is the problem. It used to, but it no longer does. An example is included.
example of what I see when i get an error. none of the x marks id's the line of code with the problem
As a newcomer, it would help tremendously for me to understand the line of the code that is the source of the issue. This was a feature previously available, but it no longer is for me. This feels like a simple settings issue, but I can not solve it. Any insights would be appreciated. I am running Xcode 13, Swift 5; the MacOS is Big Sur 11.6 (note this problem has been ongoing - i've just reached my frustration level tonight).

Related

Problems in generating UIKit/UICloudSharingController.h

When I compile my app I get a long list of errors all connected to
UIKit/UICloudSharingController.h
as you may see in the attached screenshot.
What does it mean and how to fix it?
The issue was due to a very weird problem Apple helped me to find out. In practice I used flag share in #if clauses to shield piece of code in the appropriate target. What I found was that this flag is also used somewhere by Apple itself and so I shielded even some parts of its code with the errors I reported. Once renamed to sharespare, the name of the app, the problem all but disappeared.

Why do I get Source Kit Service terminated error? [duplicate]

This question already has answers here:
Error Xcode 6 --> Error SourceKit terminated. Editor functionality temporarily limited [duplicate]
(9 answers)
Closed 8 years ago.
With second line something wrong, what?
let modelURL = NSBundle.mainBundle().URLForResource("xxx", withExtension: "momd");
let managedObjectModel = NSManagedObjectModel.init(contentsOfURL: modelURL)
In my case I had imported missing files in bridged header.
After I deleted it the error notification gone.
the issue is the ";" letter end of the first line, I removed it, and now it works, no popup anymore, that was an interesting side effect
In my case, I created about 6+ swift files for one or two targets and SourceKit Service Failure errors occurred. I found I was importing Frameworks that I was not using. So I deleted many of the import lines across the .swift files. For me, it was helpful; I am getting (much) less error.
Hope this helps.
KW
I run across this every once in a while too. As near as I can tell, it's an issue that occurs when you try to do something that the type checker doesn't think is valid - I run across it a lot when writing for-in loops. You should file a bug report, detailing what code, exactly, produces the error.
For now, you'll probably have to play with it until you find a combination that doesn't make the realtime-compiler angry.
Set the target to 7.1 fix my issue. Hope this helps you.
Update:
I have a working solution here, works for me:
Error Xcode 6 --> Error SourceKit terminated. Editor functionality temporarily limited
Hope can help

Xcode "Use of undeclared identifier" errors, compiles/runs just fine

I've got an incredibly annoying issue that is hampering my workflow. In my project I have "User of undeclared identifier" errors all over. They are all in reference to a single class, specifically a Theme class. I checked for any circular referencing with my imports, none. I'm really confused.
Here is a screenshot of the errors. I would post errors in the Build Log for more detail, but there aren't any. It builds and runs just fine...
I've tried cleaning, deleting the derived data... Any ideas?
I was having the same problem and noticed that all of the undeclared identifiers were declared in files that were in my pch file.
With this in mind I deleted one of the #import lines from the pch file and recompiled which failed as expected. I then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.
Hopefully this simple solution helps a few of you out if the above solutions don't.
These kinds of errors are quite common with Xcode, unfortunately. It would be great if it would auto-refresh its error list all the time, but it doesn't always. When this happens, I strongly suggest that you restart Xcode, which will flush its error cache and hopefully solve your issues.
How are you including this class? In most cases I just include the class explicitly in header and/or body - instead of the *.pch file. Then this error goes away in my case.
Also deleting the derived data workes once in a while. Did you change the location in preferences recently by any chance. I also got this error when I use a ramdisk for derived data and then go back to default. This is the most annoying case - since it causes this error to appear then in almost every file.
This error seems to happen more often in Xcode 4.4 than the prior versions.
Have you included the library files correctly? Take a look at that. Sometimes ARC issues might occur if we don't include the correct file, or something's missing or not connecting UI.
For me the issue was that I created UnityInterface.h/m file to handle the obj-c to c# interface. UnityInterface.h is already defined by Unity. I renamed my own UnityInterface to _UnityInterface and now everything works.
Just posting this for anyone who might have this problem later and doesn't find any of these solutions to work:
If you have any pragma marked #if statements that only execute if the program is in debug mode it will obviously cause anything declared inside of them to not be declared when you try to archive/export.
I had the same problem. Closing and opening XCode didn't help.
I solved it by checking errors in other targets and fixing them (I had tons of errors in my unit testing target). Also I moved header links from h files to m files. But I'm pretty sure, that the first thing was critical.
For others who experienced the same problem and tried all solution above with no result, perhaps you should try something like I did. I solved the problem simply by unplugging my iPhone USB cable from my Mac and then replugged again those cable. After that, rebuilt again and all undeclared identifier errors were gone.
I had the same error. In my case, it was on this line of code:
- (void)playerItemDidReachEnd:(NSNotification *)notification {
// some code
}
My error message said:
Use of undeclared identifier 'playerItemDidReachEnd'
I tried added this line to the .h file:
- (void)playerItemDidReachEnd:(NSNotification *)notification;
I cleaned it, I re-booted my macbook, and I was still getting the error.
Finally, I decided to try to delete the line in the .h file. I then pasted it into a text file, and then copied and pasted it back in to the .h file.
Now I cleaned and VOILA' !!! no more errors. Go figure. This happens sometimes in VBA. Somehow there seems to be unseen formatting in a line of code. So I thought it might be happening with xCode. Cutting it out, pasting into a text file, cutting out of the text file, and pasting it back in right where it was - fixed it in my case.
---- UPDATE -----
The above was posted as my answer. Apologies, apparently there's something else wrong.
After cleaning - my ERRORS were gone. Now I tried to build and run my app. THE ERRORS CAME BACK! So this time I re-created the class files after cutting out all the text, and pasting it into a text file. I did it for both my .m and .h files. But now the errors are back again after trying to run. SORRY. I don't know how to delete this text altogether cuz it is not an answer.
Tried to build and run my app. THE ERRORS CAME BACK!
There was also an error msg that I was missing a bracket ( } ). Finally I looking at the method just before this method, and sure enought it was missing the ending bracket! That was it!
Might be little late in answering.
I had this issue very recently. I fix this by updating my OS and then updating Xcode. I tried updating Xcode alone but did not happen because Xcode 9.4 requires OS High Sierra 10.13.*
Happy Updating :)
It it compile time error
Use of undeclared identifier '<class_name>'
I was run into this issue when developing own framework and app. Objective-C consumer -> Objective-C static framework
Report Navigator had a clear description
umbrella header for module '<module_name>' does not include header '<class_name>.h'
The solution was just to add #import <class_name>.h into umbrella header in a framework target
Try to click Product -> Analyze, after that to Product -> Build. This helped for me.

XCode 4.2 Debugger Issue: Showing incorrect values + addresses for pointers

I've taken a screenshot of the compiler inconsistencies that I have been getting when creating new ViewControllers in my current project.
In this example, the debugger shows a different value for my variables 'kim', 'fakekim', and 'blah' from my log output (which shows the correct values). The debugger consistently shows the next instance variable obtaining the current instance variable's value ('fakekim' is assigned the value that 'kim' is supposed to have).
The issue seems to be project-specific. I've been able to reproduce the issue by importing my project on another Mac. However, if I create a new project, the debugger works fine. Was hoping to figure out the issue to prevent this from happening in the future.
Thanks for your help, StackOverflow community!
Edit: Larger screenshot image: http://i.imgur.com/QfZme.png
This was a (very annoying) bug with LLDB in Xcode 4.3. It has been fixed in 4.3.2.
Probably an Xcode bug. Try dragging the .xcuserstate file from you working project to your real one, and see whether that fixes it.
You could also try a clean build (shift-command-k).

SentTestCase doesn't highlight UnitTest failures as errors in code

I have setup UnitTests for some of the logic of my iphone app, I followed apple's guide for UnitTests in XCode, however when some of the assertions fail - instead of highlighting the place directly in code like a regular compilation error - XCode just displays the number of errors in the bottom-right corner and I have to look up the errors in the output log. Does anyone know what additional steps one has to take to make XCode highlight assertion failures in UnitTests like regular errors in code?
This is a known bug in Xcode. I don't think it has worked for at least as long as version 3.2.x but it might have broken earlier. I filed a bug report with Apple back in march but it got closed as a duplicate so they are aware of the problem. I don't imagine it will get fixed in the 3.X incarnation since Xcode 4 is on its way.