ios - 标有@objc 的 Swift 类未添加到混合 Objective-C/Swift 框架中的 "-Swift.h" header

标签 ios objective-c swift xcode

我正在尝试将旧的静态链接库转换为框架。在静态库中混合使用 swift 和 objective c,可以正确生成所有 header 。但是,切换到框架目标并添加标有 @objc header 的 swift 文件时,该类不会添加到 -Swift.h header 中。我可以导入 header ,但找不到 swift 类。这是在 Xcode 10.2 中,并尝试同时使用 Swift 4.2 和 5。

XCode 中是否有任何特定设置会影响混合 Objective C/Swift 框架目标中 *-Swift.h header 的生成?

最佳答案

我遇到了类似的问题。就我而言,这是 Xcode 10.2 中的一个已知问题:

https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes

If you’re building a framework containing Swift code and using lipo to create a binary that supports both device and simulator platforms, you must also combine the generated Framework-Swift.h headers for each platform to create a header that supports both device and simulator platforms. (48635615) ...

在我的例子中,我所要做的就是将 Carthage 更新到最新版本 0.33.0

关于ios - 标有@objc 的 Swift 类未添加到混合 Objective-C/Swift 框架中的 "-Swift.h" header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55368671/

相关文章:

swift - 圆角 NSTextField 用透明角绘制?

ios - 覆盖 prepareForSegue 不起作用

ios - react-native-image-picker - 重建后的持久存储

ios - Xcode 8 和模拟器 10 上的 3D Touch

ios - UIButton 的空自定义类改变了它的外观

objective-c - 使用 Cocoa NSFIleManager 忽略文件夹中的 .DS_Store 和 Icon 文件

swift - Firebase 上传图片

iphone - 是否可以在 ScrollView 中制作单选按钮

iphone - cllocation -distanceFromLocation 准确性差

使用 Swift 读取文本文件的 Pythonic 方式