当通过CocoaPod将Objective-C框架导入到Swift项目中时,桥接头中的“找不到文件” [英] “file not found” in Bridging Header when importing Objective-C frameworks into Swift project by CocoaPod

查看:562
本文介绍了当通过CocoaPod将Objective-C框架导入到Swift项目中时,桥接头中的“找不到文件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个快速项目,并使用CocoaPod导入第三部分存储库。在pod文件中,我使用 use_frameworks!,因此存储库将构建到框架中以供使用。我在我的桥接头文件中导入ObjC框架,如 #import #import<>
在这种情况下,我运行该项目,它工作。但是当我存档时,在桥接头文件中找到找不到文件。

 `BridgingHeader.h:5:9:error:'RESideMenu / RESideMenu.h>'找不到文件
#import< RESideMenu / RESideMenu.h>
<未知>:0:错误:无法导入桥接头'xxx-Bridging-Header'`



 `无法导入桥接头'/ Users / xxx / Documents / xxxProjectName / xxxProjectName / xxxProjectName-如何解决问题?$ b 

解决方案

我的解决方案是:

不要在桥接头文件中导入ObjC框架,只需将框架导入其中包含框架是必要的。就像:

import xxxframework


I got a swift project ,and use CocoaPod to import the third part repositories. In pod file I use use_frameworks!, so the repositories will build into framework to use. And I import the ObjC framework like #import "" or #import <> in my Bridging Header.
In this situation, I run the project, it works. but When I archive, "file not found" is found in Bridging Header file.

`BridgingHeader.h:5:9: error: 'RESideMenu/RESideMenu.h>' file not found 
#import <RESideMenu/RESideMenu.h>
<unknown>:0: error: failed to import bridging header 'xxx-Bridging-Header'`  

and

`failed to import bridging header '/Users/xxx/Documents/xxxProjectName/xxxProjectName/xxxProjectName-Bridging-Header.h'`

How can i solve the problem?

解决方案

My solution is :
Do not import the ObjC framework in bridging header file, just import the framework in the files in which the framework is needed. just like:
import xxxframework

这篇关于当通过CocoaPod将Objective-C框架导入到Swift项目中时,桥接头中的“找不到文件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆