我正在尝试将旧的静态链接库转换为框架。在静态库中混合使用 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/