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

喜夏-厌秋 提交于 2019-11-28 18:24:31

问题


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?


回答1:


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.




回答2:


I had problems with this. My bridging header wasn't finding pod libs. I ended up finding out that I have to do this.




回答3:


Try this:

import  <DBSphereTagCloud/DBSphereView.h>
import  <DBSphereTagCloud/DBSphereView.h>



回答4:


For me...

Original

import  "<Folder/File.h>"

Change to

import  <Folder/File.h>



回答5:


In Project > Build Settings > Search Paths > Header Search Paths

Add:

"${PODS_ROOT}/Headers/Public/[Name of folder which pod files are contained in]"

Do that for every pod you installed



来源:https://stackoverflow.com/questions/29080026/how-to-reference-header-files-in-bridging-header-h-after-updating-cocoapods-to-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!