1

I have gone through various solutions that has been posted in the forums but still wasn't able fid a solution for this issue. I faced an issue which states Unable to find bridging header. I ran through various solutions online and added the file path in the Build Settings like /Users/user/Desktop/AppFolder/App/BridgingHeader.h. I tried running the applications and it resulted in an error failed to import bridging header '/Users/user/Desktop/AppFolder/App/BridgingHeader.h'. Along with 'YTPlayerView.h' file not found.

I changed the path to $(SRCROOT)/BridgingHeader.h which solved the issue of YTPlayerView.h' file not found but rebounding of issue Unable to find bridging header. I tried removing the header and recreating it various times but still wasn't able to find a solution.

Thanks in advance

2
  • If you can successfully import all the files defined in bridging header then cross check for the bridging header path, it might be incorrect Commented Jun 14, 2017 at 9:24
  • check your bridging header file url Commented Jun 14, 2017 at 9:26

1 Answer 1

1

Try it with below code :-

First create your bridging header file inside the root folder of your app. See the below image:

enter image description here

Now set the correct url for your header file inside the Build Settings -> Swift Compiler like below image :

And then double click on the blank space of Objective-C Bridging Header key so you will get one popup.

Then drag n drop your header file inside that popup so you will get whole path as like in image.

enter image description here

Now Remove the all file name which comes before your app name and bridging File.

Note : If you have 2 App name then remove one name also.

See this final image:

enter image description here

Now it will work like a charm. Enjoy coding.

Sign up to request clarification or add additional context in comments.

6 Comments

@Tarsariya Thanks for the immediate and detailed response Tarsariya. I followed the pattern which you have mentioned above, but It still displays compilation errors failed to import bridging header '/Users/user/Desktop/AppFolder/App/BridgingHeader.h', 'YTPlayerView.h' file not found.
You need to set only App/BridgingHeader.h as a bridging header path
@Tarsariya Yes Tarsariya, I set it to App/BridgingHeader.h as stated but still wasn't able resolve the issue.
To check if this path is correct then first you have to remove all import from that header file and make it empty. Then build the app if you dont get any error regarding header file then your path is correct and this issue may regarding to your import file.
@Tarsariya Thanks a lot of the help Tarsariya. It seems like the issue is the cocoa pod framework I installed. You suggestion perfectly worked for the project file without that framework.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.