简体   繁体   中英

Bridging Header File can't find an imported Objective-C project

I'm trying to import this library (SCRecorder) into my Swift project using the "Bridging Header File" method. But I really can't make it work. When I try to build the project, I get the following error :

error: 'SCRecorder/SCRecorder.h' file not found 
#import <SCRecorder/SCRecorder.h>

Here is the content of my bridging header file :

#ifndef Project_Bridging_Header_h
#define Project_Bridging_Header_h

#import <SCRecorder/SCRecorder.h>

#endif

And here is my project structure :

在此处输入图片说明

Of course I have added the reference to the Bridging Header File in my Build Settings. I'm almost sure it's just a path issue... But after some hours spent on this, I really can't find a solution.

Thanks.

EDIT : Instead of importing the project directly, I have added it with the CocoaPods method, and I get a new error :

library not found for -lSCRecorder

OK. I figured it out. I just didn't use the *.xcworkspace project after installing pods... After opening my project with this file, everything works well, as expected.

Thanks for your help, especially @kaizoku for suggesting me to use this file.

You should try to install the library using 'cocoapods'
There could be something wrong while importing the project manually.

Here is a tutorial on how to install Cocospods and initialise your podfile in your application.

Then you can add pod 'SCRecorder' in the Podfile and go back to the terminal and type pod install .
This will install all the dependent libraries for SCRecorder.

Finally, go and try running the build. It should work.
Safe side, keep a backup of this build. Good Luck :)

I had a similar issue with pods. Basically trying to run my UI tests, Xcode complained about missing pods. Solution to this was:

  1. go to project file (main not a target)
  2. click on the "Info" tab (most left)
  3. set proper pod configuration for UI tests target ("Configurations" section right under "Deployment Target")

Working!

A bit more about this: https://github.com/CocoaPods/CocoaPods/issues/2695

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM