Objective C桥接框架的标头 [英] Objective C Bridging Header for frameworks

查看:119
本文介绍了Objective C桥接框架的标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个需要sqlite3框架的框架。如何为我的框架添加一个Objective C Bridging Header,将sqlite3导入我的Swift文件?



我的项目已经有一个桥接头文件,但不是我的我找到了一个 Objective-C桥接标题 >在目标构建设置中进行设置。它默认是隐藏的。检查全部而不是基本。



在最近的Xcode版本中,此解决方案将给出错误不支持使用带有框架目标的桥接头



我一直在使用的解决方法是在文件检查器中创建C-header public 并导入它在 MyFramework.h 中就像这个例子:

  #import< MyFramework / MyObjectiveC.h> 

如何将C标题更改为 public



打开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.

解决方案

I found a Objective-C Bridging Header setting in the target Build Settings. It was hidden by default. Check All instead of Basic.

In recent Xcode versions this solution would give the error Using bridging headers with framework targets is unsupported.

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>

How to change the C-header to public

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屋!

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