Failed to import bridging header in xcode 8 - ios

I have updated my project from xcode 7.3 to xcode 8 that project is mixture of cordova and native .I am getting error of Bridge Header not found .. I have tried many solutions even I have made a new bridge header many times but getting same error always
error
:0: error: failed to import bridging header

A possible cause for this would be that the Bridging Header is not properly connected to your project.
Solution 1:
I strongly recommend deleting your current Bridging Header and then go to File -> New File -> Objective-C Source File(.m). When you create the file it will ask you if it should create a new Bridging Header. Click Create. After that, put your #import statements in the new header, and delete the .m file, which is unnecessary. Then, you're good to go.
Solution 2:
To check if your Bridging Header is connected properly to your project, go to Project -> Build Settings -> Swift Compiler - General. There, you will have the option Objective-C Bridging Header.

Related

In my IOS Project, when i try to remove Bridging Header file cause error?

To setup a SideMenu in my iOS project, I'm Using SWRevealViewController without pods and this create a bridging header file
SWRevealViewController.h
SWRevealViewController.m
MyProjectName-Bridging-Header.h
Now I want to remove these three files and add my custom SideMenu, but this cause a big problem
I trying some solutions which I found in stackoverflow and another websites like 1. go to Target > Build Settings > Swift Compiler - General > Objective-c Bridging Header and remove its value. but this case a lot of errors. 2. retrive just this file 'MyProjectName-Bridging-Header.h' but this again cause a lot of errors.
the project does not work successfully without the three file. although i don't use these three file in any part of my project.
when I delete the three files + clean the Objective-c Bridging Header I get this error.
Edit: I note that after I do the deletion step the 'import UIKit' disappears from most files in the project.
I solve the problem by the following steps
1- Delete these two files which caused in creating bridge file
SWRevealViewController.h
SWRevealViewController.m
2- remove #import "SWRevealViewController.h" from Bridging file and add #import <UIKit/UIKit.h>
and this solve the problem for me.
Are these only 3 OBJ-C files you use in your project?
Here are the steps you should follow:
1. Delete all the {{obj-c}}.h,.m,.xib along with AppName-Bridging-Header.h
Then go to Target > Build Settings > Swift Compiler - General > Objective-c Bridging Header and remove its value, as you saw in multiple stack overflow post.
Clean build and run the project to solve the errors

using Swift code in Objective-C project by creating bridge files in iOS

while merging swift code to objective c existing projective c project am not able to import the header files into bridge file and also i get some syntax errors in the merged swift classes am getting following errors what has showed in image
Do you create Bridging Header from these steps.
Step1. Create Bridging Header file
Step 2. After creating bridging header goto Project Settings and search Objective-C bridging header and add bridging header file path.
By following these step you have successfully added bridging header file. Next you have to import framework, you like to add.
If you still found any issue then show us the error.

objective-c Bridging header not found in swift compiler-code generation

I am doing an ios app in swift 3. And I want to add ARKitwhich is available in objective-c. I dragged all objective-c files into my project then it asked to create bridging header. So I let it to create. And I imported all objective-c.h files inside that like this.
But when I try to build its showing 22 number of issues like UIViewcannot identify etc..
Then I tried to add the bridging headerpath to build settings under swift compiler - code generation. But I dont see objective-c Bridging headersection under that.
Please help me. What can I do to add these objective-c files into my swift 3 project successfully.
Thanks
The Objective-C bridging header setting can be found under Swift Compiler - General under Build Settings.
But I like to add the bridging header by having Xcode generate it for me. I add a junk Objective-C class by File > New > File... and it will ask me if I want to add a bridging header to my project.
If you do that, you'll only need to move whatever you have in your bridging header now to that one and delete the header you have now. The header will be set properly in the project's settings.
Make sure your build setting is selected as "All" and "Combined" look at below link
Swift Compiler - General is missing in Xcode 9.1

How do I remove a bridge header without getting errors?

I added a bridge header to my app the other day because I was trying to add Objective-C files to my Swift project. I was having trouble getting the connection to work(and I also did not know how to implement the Objective-C files), so I decided I wanted to start over again. I deleted the Objective-C files and the Bridge-Header file and now I am getting an error saying:
<unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey-Bridging-Header.h' does not exist
Go to Build Settings of your project, find Objective-C Bridging Header row and remove its contents.
Go to targets file->Build Settings->Swift Compiler - General, delete the contents in the same line as Objective-C Bridging Header
Since removing the bridging header or even just leaving it without any content often causes build errors, the quick workaround I've found is leaving the header with nothing but the following two imports:
#ifndef BridgeHeader_h
#define BridgeHeader_h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
Deleting the lines containing SWIFT_OBJC_BRIDGING_HEADER in MyProjectName.xcodeproj/project.pbxproj did the trick for me.
I could not find the Build Settings in my Xcode project as other answers mentioned (maybe because my project is for MacOS, not iOS?).

Bridging Objective-C into Swift Project

I'm trying to put a bridging header file into my Swift project so I can use the Venmo SDK. I've placed the header file where I believe it should go and have added it to the Swift Complier - Code Generation section under build settings.
The bridging header is titled BridgingHeader.h and is directly under the project subsection (would post photo but I don't have enough reputation). It's in the same location as this link:
Under the swift compiler - code generation my path to the bridging header is BridgingHeader.h. Initially I tried to reference the file from the root directory but I still had an error saying error:
bridging header '/Users/j9/Desktop/uSell-swift/BridgingHeader.h' does not exist
Apparently, the compiler is looking for .../BridgingHeader.h, while the actual name is LearnSwift-Bridging-Header.h.
By the way, you can avoid these annoyances by adding an ObjC class File->New->Source->Objective C file... It will create and configure the header for you.

Resources