框架的Objective-C桥接标头 [英] Objective-C Bridging Header for frameworks
问题描述
我制作了一个需要sqlite3框架的框架。如何为将sqlite3导入到我的Swift文件中的框架添加一个Objective-C桥接头?
I've made a framework that requires the sqlite3 framework. How do I add a Objective-C Bridging Header for my framework that imports sqlite3 into my Swift file?
我已经有一个项目的桥接头文件,但是没有我的框架。
I already have a bridging header file for my project, but not for my framework.
推荐答案
我发现了 Objective-C桥接标题
目标构建设置中的设置。默认情况下它是隐藏的。
I found a Objective-C Bridging Header
setting in the target Build Settings. It was hidden by default. Check All instead of Basic.
在最近的Xcode版本中,此解决方案将给出错误不支持使用带有框架目标的桥接标头
。
In recent Xcode versions this solution would give the error Using bridging headers with framework targets is unsupported
.
我一直在使用的解决方法是在文件检查器中将C头文件公开并导入像这样的例子在 MyFramework.h
中:
The workaround I've been using is to make the C-header public in the file inspector and import it in MyFramework.h
like this example:
#import <MyFramework/MyObjectiveC.h>
如何将C标头更改为 public
How to change the C-header to public
打开C头并单击右上角的来查看检查器。要查看文件检查器,请单击右上角的文件图标。
Open your C-header and view the inspector by clicking in the upper right corner. To view the file inspector, click the file icon in the upper right corner.
这篇关于框架的Objective-C桥接标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!