Xcode 6 / Beta 4:使用桥接标头与框架目标不受支持 [英] Xcode 6 / Beta 4: using bridging headers with framework targets is unsupported

查看:589
本文介绍了Xcode 6 / Beta 4:使用桥接标头与框架目标不受支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到Xcode 6 Beta 4,并为Beta 2中的Live Views创建了一个框架。由于另一个快捷方式downcasting-cftype-based-coretext-types-in-a-cfarray> bug ,我需要使用一些Obj-C代码。当升级时,我得到以下错误:

lockquote

错误:使用桥接标头与框架目标不受支持


我在发行说明中没有看到任何内容,或者找到任何其他迁移路径。有没有其他人看到这个并且达到了解决方案?

我意识到Beta 3消除了对实时视图框架的需求,但在我的情况下,如果我能够实现它,这是有道理的。我可以将它作为后备删除,但是如果它们在Beta 4中没有被完全破解,则宁愿使用它。

>由于错误状态,Frameworks中不允许桥接头。 部分。 htmlrel =noreferrer> Mix&匹配苹果文档提示。正如他们所说的,你需要在你的伞头文件中,导入你想暴露给Swift的每一个Objective-C头文件。

然而,我发现你也可能需要公开那些特定的标题。这个答案回顾了为什么以及如何做到这一点: Swift编译器错误:

所以,请这样做:


  1. 删除您的桥接头文件。

  2. 删除对框架的构建设置中的桥接头文件的引用。 ([ProductName] .h)必要的标题

  3. 在框架的构建阶段的标题部分中公开包含的文件。

  4. 清理并重建。

(名为[ProductName] .h),通常表示框架的所有公共标题。它通常只是包含在框架中的其他头文件的#import语句列表。在Xcode中,如果你打开UIKit.h,你会看到一个伞形文件的好例子。


I just upgraded to Xcode 6 Beta 4 and have a framework that I created for Live Views in Beta 2. Due to another swift bug, I needed to use some Obj-C code. When upgrading though, I get the following error:

error: using bridging headers with framework targets is unsupported

I have not seen anything in the release notes, or found any other migration path. Has anyone else seen this and arrived at a solution?

I realize that Beta 3 eliminated the need for frameworks for live views, but it makes sense in my case if I can get it to work. I can remove it though as a fallback, but would prefer to use a framework if they are not totally broken in Beta 4.

解决方案

As the error states, bridging headers are not allowed in Frameworks. The Importing Code from Within the Same Framework Target section of the Mix & Match apple documentation hints at this. As they say, you need to "In your umbrella header file, import every Objective-C header you want to expose to Swift".

However, I discovered that you may also need to make those specific headers public as well. This answer reviews why and how to do that: Swift compiler error: "non-modular header inside framework module".

So, do this:

  1. Remove your bridging header file.
  2. Remove references to the bridging header file in the build settings for the framework
  3. Add the necessary headers to your umbrella file ([ProductName].h)
  4. Make the included files public in the framework's "Headers" section of its "Build Phases".
  5. Clean and rebuild.

Note: The "umbrella header file" is a file (named [ProductName].h) that generally represents all public headers of a framework. It is usually just a list of #import statements to other headers contained in the framework. In Xcode, if you open UIKit.h, you will see a good example of an umbrella file.

这篇关于Xcode 6 / Beta 4:使用桥接标头与框架目标不受支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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