How to reference header files in Bridging-Header.h after updating CocoaPods to 0.36.x and above?

nmdias picture nmdias · Mar 16, 2015 · Viewed 27.3k times · Source

After updating to CocoaPods 0.36.x, I am unable to add imports into my Bridging-Header.h file. I get the "DBSphereView.h file not found".

The file is indeed present in:

"Pods/DBSphereTagCloud/DBSphereView.h"
"Headers/public/DBSphereTagCloud/DBSphereView.h"
"Headers/private/DBSphereTagCloud/DBSphereView.h"

My bridge file:

#ifndef Loan_Bridging_Header_h
#define Loan_Bridging_Header_h
#import "DBSphereView.h"
#endif

I am able to use Frameworks. I have a reference to a well known Framework (Alamofire), and it works great!

My podfile:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'DBSphereTagCloud', '~> 1.0'
pod 'Alamofire', '~> 1.1'

Before updating, I had no problems with importing header files.

How do I reference header files in Bridging-Header.h after updating CocoaPods to 0.36.x?

Thank you!

EDIT:

I also tried to create a separate project based on the example "Get Started" from cocoapods.org, without success. After using Frameworks, I can't seem to reference header files in my bridging header file. I must be missing some detail?

Answer

Para picture Para · Mar 17, 2015

In your Podfile, you specified use_frameworks!.

As a result, the Objective-C code you're including as a dependency (DBSphereTagCloud) is packaged as a framework, instead of a static library. Please see CocoaPods 0.36 - Framework and Swift Support for more details.

As a consequence, you don't need a bridging header file. It's enough for you to add:

import DBSphereTagCloud

in all the Swift files that need that module.