ios - swift:弱不能应用于导出

标签 ios swift weak-references iboutlet zbar-sdk

我正在使用 libzBarswift 中扫描二维码,但我收到了这些错误。

errors image .

第一个错误是关于弱引用,第二个是未声明的类型。 起初我以为我没有包含 ZBarReaderView.h 但在检查文件检查器后我发现文件正确添加为

file inspector image

我已经在 Objective-C 中添加了一个 ZBarReaderView,它工作正常。我还查看了添加 EmbeddedReader(ObjectiveC) 的示例项目。

所以我想知道为什么会出现此错误以及如何消除此错误?

解决方案:

To import a set of Objective-C files in the same app target as your Swift code, you rely on an Objective-C bridging header to expose those files to Swift. Xcode offers to create this header file when you add a Swift file to an existing Objective-C app, or an Objective-C file to an existing Swift app.

最佳答案

看起来您没有创建桥接头。关注Apple Docs创建一个,然后在桥接 header 中导入 ZBarReaderView.h。

关于ios - swift:弱不能应用于导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30188413/

相关文章:

ios - 两个 UITabBarControllers 共享一个 ViewController(作为选项卡内容)?

ios - swift 中的 UiAlertMultiple 行问题

swift - 如何打开可选的 NSDictionary

objective-c - 一起旋转 X、Y 和 Z 轴

swift - 弱小的自己去哪儿了?

ios - 如何使用 AVAssetDownloadTask 下载尚未流式传输的 FairPlay 加密 AVURLAsset 实例?

ios - 根据 UITextView swift 的大小向上移动 subview

python - python中的弱引用列表

ios - 如何在 Swift 中创建弱引用字典?

iphone - 从这个示例代码的服务器中的 xml 文件解析 xml 值