获取“找不到文件"将 Objective-C 框架导入 Swift 项目时在桥接头中 [英] Getting "file not found" in Bridging Header when importing Objective-C frameworks into Swift project

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

问题描述

我有一个 Swift 项目,我正在尝试为其导入基于 ObjC 的框架.框架位于项目路径下的目录中,在Xcode中被项目引用.它还添加到项目构建阶段"页面中的将二进制文件与库链接".

I have a Swift project for which I'm trying to import ObjC-based frameworks. The framework is located in a directory under the project's path and is referenced by the project in Xcode. It's also added to the "Link Binary with Libraries" in the project's 'Build Phases' page.

但是,出于某种原因,我似乎无法将框架包含在 Bridging-Header 文件中.我收到以下错误:

However, for some reason, I can't seem to include the framework in the Bridging-Header file. I get the following error:

BridgingHeader.h:5:9: error: 'Parse/Parse.h' file not found
#import <Parse/Parse.h>
        ^
<unknown>:0: error: failed to import bridging header 'BridgingHeader.h'

我检查过的东西:

  1. 安装 Objective-C 兼容性标头"设置为是".
  2. 标题搜索路径包括框架的路径.

我确定我遗漏了一些东西,所以如果有人有任何线索,那就太好了.

I'm sure I'm missing something, so if anyone has any clues, that would be great.

推荐答案

找到解决方案:

  • Objective-C Bridging Header"设置(又名 SWIFT_OBJC_BRIDGING_HEADER)必须在目标级别设置,而不是在项目级别.请务必删除项目级别的设置值.
  • The "Objective-C Bridging Header" setting (aka SWIFT_OBJC_BRIDGING_HEADER) must be set at the Target level, and NOT the Project level. Be sure to delete the setting value at the Project level.

(对我来说,这似乎是一个 Xcode 错误,因为我不知道它为什么要修复它).

(to me, it seems like an Xcode bug, since I don't know why it fixes it).

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

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