Swift Compiler Error - failed to import bridging header - ios

I'm trying to integrate Actor App for iOS. On compiling, I get this error :
I checked the path and the ActorClient-Bridging-Header.h is present there.
I have set the proper path to the header file in Build Settings
And this is the folder structure :
What might be the reason for this compilation error?
EDIT
I tried solving the same as mentioned here : Swift Bridging Header import issue and no luck.
Screenshot of the actual path on my disk :

Just go to your project's Framework Search Path,which I assume would be empty and add the path of your SDK folder there.
For adding the path correctly, you can just drag and drop your SDK folder here,the correct path from root will be added automatically.
Hope this will help!!

Bridging header file should be placed at root folder.

Related

Swift file integration error

I am a swift developer and just started working on an Objc project by adding swift code in it.
I'm really blocked with this error here, no matter what i do i still got this error
The file i added is in a submodule and i got this error :
Thank you for your help :D
Can you tell me when you were added your swift file in your objective c code at that time Xcode ask about to add Bridging-Header file ? if not then you can add it from new file -> Header File by right clicking on your project. Do the following things : -
Into your build setting search for the key Defines Module and make it yes
Remove all header file path from Header Search Path and just drag and drop your Bridging-Header.h file path
After that remove derived data and import your "ProjectName.Swift.h" file where you want to use your swift code.
Let me know if you need any help.

Unable to import bridging header

Im trying to link an external Objective-C framework, "frameworkSDK", to my swift project. However I seem to be getting this error :
<unknown>:0: error: failed to import bridging header
I've looked at loads of solutions to my problem but non of them seem to work. Here's what I've done so far :
I've created a "bridingfile.h" at the root of the project and
imported "frameworkSDK.frameworkSDK.h" to the file.
I've made sure Objective-C Bridging Header path was correct under
Swift Compiler - Code Generation.
I've changed my framework search paths to the where the
"frameworkSDK" is located - Code Generation.
Added the path to "bridgingfile.h" to Header Search Paths - Code
Generation.
I've tried to instead create the bridgingfile 1 directory in from
the root folder, and then update accordingly.
Any help would be greatly appreciated! :)
If you are importing an external Objective-C framework, i.e. one stored in, say, frameworkSDK.framework directory structure (bundle), you should not have to worry about a bridging header. Instead do the following:
Under Build Settings set Framework Search Paths to the parent
directory of the frameworkSDK.framework directory.
Also under Build Settings set Runpath Search Paths to
$(FRAMEWORK_SEARCH_PATHS) #executable_path/../Frameworks.
In a Swift file where you want to use the Objective-C framework do
import frameworkSDK.

Importing a library in to an Xcode 7 project

So I am trying to add a static library to my project in order to interface with a scanner. I have linked the binary in build phases to the libCaptuvoSDK.a, put the Captuvo.h header file in the project folder, and finally set the project to always search the user paths and added $(BUILT_PRODUCTS_DIR) recursive to the user header search paths. After doing all this I am trying to use #import "Captuvo.h" in my ViewController.swift file and getting the 2 errors Expected identifier in import declaration, and Expected expression. I have tried different combinations of importing and none of them seem to make a difference so I am led to believe the issue is with my process of adding the library.
I am new to Xcode and have never used a third party library in an application before so I feel I may be making a simple mistake or just misinterpreting things. Any help is appreciated!
Okay so I managed to fix my issue! I had imported the static library properly but the real issue was the header file. I fixed my issue by creating a new file in my projects folder named Quick-Scan-Bridging-Header.h. Inside that file is where the #import "Captuvo.h" line belonged. Once that was done I opened the Quick Scan apps build settings and under Objective-C Bridging Header I added the path Quick Scan/Quick-Scan-Bridging-Header. I also added the Header Search Path $(BUILT_PRODUCTS_DIR)
After I did all this I am able to use the Captuvo classes in my ViewController.swift file.

How to import chilikat classes to swift?

I'm trying to use chilikat's ftp classes in my project. But when I tried to compile I got an error(shown below) from xcode. What reason of that error?
And my second question is: I used this import statement:#import "CkoFtp2/CkoFtp2.h" and I got the second error here?
Path of bridging header file:
P.S. I got the path by dragging the file into terminal.
You seem to be assuming that the problem is in the path of the bridging header. That path is fine (otherwise you wouldn't have gotten an error about the #import line inside the bridging header).
The problem appears to be the CkoFtp2/CkoFtp2.h header path. Looking at your directory listing, there is no CkoFtp2 subdirectory, but rather you appear to have copied it to your main project directory. That means that you should try:
#import "CkoFtp2.h"

Objective-C cocoapod bridging issue

Followed this to a t:
https://medium.com/#kirualex/cocoapods-with-swift-e6f8ba8f0afc
Can't find these 2 header files though.
Set the bridging file in the settings:
I always meet this kind of problem. I think you can try to check your file&folder hierarchy.
Such as you have a root folder named Project, as is often the case, there is another Project in your previous Project, the root folder.
And Checking the Objective-C Bridging Header in the Build Setting. Sometime error can occurred for Project/Project/Bridging-Header.h. And the error can be corrected by changing the definition as Project/Bridging-Header.h.
If the location of Bridging-Header.h is not matching with the definition in the Build Setting, the error like import file not found will occur.
I just tell your my solution for Bridging issue I already met, I hope it can help you.

Resources