【发布时间】:2017-02-22 14:46:29
【问题描述】:
我想在 Swift 项目中使用 Objective-C 库 https://github.com/ameingast/cocoaimagehashing。我用 Cocoapods 安装了它。 我不能使用它,它在构建时会引发以下错误:“使用未声明的类型”或“使用未解析的标识符”。
令人惊讶的是,当我编写 OSImageHashingProvider 并单击它时,它会跳转到它定义的 .h 文件中。
我在项目中添加了一个桥接头,但我没有理由相信它处于活动状态。
我在 Build Settings -> Swift Compiler - General / Objective C Brigding Header 中添加了它。
Build Settings -> Other Linker Flags 有 -ObjC。和 -l “CocoaImageHashing”。
我的 pod 是:
target 'Projectname' do
pod 'CocoaImageHashing', :git => 'https://github.com/ameingast/cocoaimagehashing.git'
end
我不使用 use_frameworks!因为它在构建时引发错误。
解决办法是什么?
【问题讨论】:
-
你的 Swift 文件顶部有
import CocoaImageHashing吗? -
它不接受它,说'没有这样的模块'CocoaImageHashing''
标签: objective-c swift bridging-header