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

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

问题描述

我有一个 swift 项目,并使用 CocoaPod 导入第三方存储库.在 pod 文件中,我使用 use_frameworks!,因此存储库将构建到框架中使用.我在桥接头中导入了像 #import ""#import <> 这样的 ObjC 框架.
在这种情况下,我运行该项目,它可以工作.但是当我存档时,在桥接头文件中找到找不到文件".

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'`  

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

我该如何解决这个问题?

How can i solve the problem?

推荐答案

我的解决方案是:
不要在桥接头文件中导入ObjC框架,只需在需要框架的文件中导入框架即可.就像:
导入xxxframework

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

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