Swift - Tries to open a bridging header that I have since deleted - swift

I'm playing around making a Swift CLI tool but I've run into a bit of a problem with bridging headers. I was going to use some c++ scripts, so I made a c++ file in the project in Xcode and agreed to Xcode making a bridging header for me. I realised a few minutes later that I could do the necessary coding in Swift, so I deleted the bridging header and c++ file.
But now, whenever I try to compile the project, I get an error saying
error opening input file '/path/to/project/ProjectName-Bridging-Header.h' (No such file or directory)
Does anyone have any idea how to tell Xcode to stop looking for the header? I've tried the obvious tricks like saving and restarting.
Cheers

Related

Xcode cannot find my Localizable.stringsdict file

I am trying to add pluralizable localization to my Xcode project, using Xcode 11.2.1
I followed the steps in this tutorial: https://medium.com/#vitaliikuznetsov/plurals-localization-using-stringsdict-in-ios-a910aab8c28c , which is a pretty basic instruction on how these things work. Mine, however, did not work, SO, I tried the following:
0) Actually running the tutorial code to make sure it works on my copy of Xcode. It does.
1) Copying the example Localizable.stringsdict from the tutorial into my program, and using
the keys from said tutorial in my calls, in case I had made a bad Localizable.stringsdict
or was calling it wrong. This failed.
2) Creating the Localizable.stringsdict as a property list, as some older questions suggested, instead of a Stringsdict file when creating it new, and copying the known 'good xml' of the example plist into it. This failed.
3) I tried removing all localized content from the project, and re-adding the strings file and the stringsdict file. Now it can't find either of them.
Clearly I must be missing some configuration, some step, some way of saying HEY XCODE LOCALIZE THESE. When I look at the 'Localizations' tab in the Project, there is only 1 file localized, for "Base"
Yesterday, I succeeded to localize Swift App using this tutorial.
Please try to follow this tutorial. Thanks
Number 4 was the clue here. My project has a lot of targets. Add your stringsdict file to the targets it needs to be added to. Derp.
I added the dict file to the proper target and everything works fine.
Always check the obvious stuff first.
Open your localized stringdict file, then in the right inspector click on Identity and Type you will see localization block with a button, click on it and project will recognize your file now

AST Deserialize Issue, input is not a PCH file

I'm currently taking over someone's else project who was in a different country. He is using MumbleKit in his project, however when i try building the project, these errors occurred.                                        
error: input is not a PCH file: '/Users/kai/Library/Developer/Xcode/DerivedData/TestBuild-bivflkvgwypsqidilllttbdfyjjq/Build/Intermediates.noindex/PrecompiledHeaders/SharedPrecompiledHeaders/70367429320928002/CELT-0.7.pch.gch'
fatal error: file '/Users/kai/Library/Developer/Xcode/DerivedData/TestBuild-bivflkvgwypsqidilllttbdfyjjq/Build/Intermediates.noindex/PrecompiledHeaders/SharedPrecompiledHeaders/70367429320928002/CELT-0.7.pch.gch' is not a valid precompiled PCH file
Now, i have tried fixing the header path file and cleaning the project and deleting derived folder's content, still this error occurred. I believe xcode is trying to find a pch file but this .gch is being created instead. How can i prevent this .gch from being created in the derived folder? Or how do i fix this in general since i don't really deal with 3rd party project dependency before.
EDIT : I believe this error is coming from the 3rd party Mumble kit, CELT-0.7 project
Okay, I've found the solution, Mumble kit's CELT project have a file : Base.xcconfig.
There is a variable, GCC_PRECOMPILE_PREFIX_HEADER, initially it was set to YES, after set it NO, that fixed it. Though it will be nice if someone would explain to me what it does exactly.

Missing Swift files

I don't really understand what's hapening but I'm not able to see all my Swift files on Xcode project navigator, but when I open my project directory I see them all, it looks like reference problems.
I'm receiving some invalid redeclaration problems.
Are you using the one of the xcode-beta builds? They seem to have some problems with file handling every now and then. Restarting fixes it for me most of the times.

Xcode 6.1 Swift Extensions - SourceKit Service Crash

I am trying to add an extension to Swift so I can format Doubles as found in this answer here
Precision String Format Specifier In Swift
Not ideal, but best solution I can find so far. However I cannot seem to add extensions to my project. Extensions work fine on playground, but when I try to add it to my project, I get the SourceKit service crash error every time I try to add the code in. I also get an error stating "declaration is only valid at file scope".
I have not previously used extensions in Swift before, so I cannot tell if this is directly related to Xcode 6.1 update or not.
Has anyone else had this issues or know anyway to solve this?
The SourceKit service crash error is pretty annoying and doesn't only happen with Extensions. I have found breaking your project up into different files has helped.

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.