Swift:无法使用Pod文件中的库 [英] Swift: Cannot use library from Pod file
问题描述
我正在使用Typhoon库进行依赖注入框架。我用 CocoaPod
来安装这个库。这是我的pod文件:
I'm using Typhoon library for Dependency Injection Framework. I use CocoaPod
for installing this library. Here is my pod file:
target "typhoon-swift-demo" do
pod 'Typhoon'
end
target "typhoon-swift-demoTests" do
end
我已成功安装,但是当我打开工作区项目文件时。我将这些代码行键入为Typhoon示例代码:
I have installed successfully but when I open workspace project file. I type those line of code as Typhoon sample code:
public class ApplicationAssembly: TyphoonAssembly {
}
我遇到我的申请无法识别的错误 TyphoonAssembly
我试图使用一些行,例如:
I meet error that my application doesn't recognize TyphoonAssembly
I have tried to use some lines such as:
import Typhoon // not recogize typhoon
import TyphoonAssembly // not regconize
请告诉我如何解决这个问题。在使用库之前我应该添加什么。谢谢:)
Please tell me how to fix this problem. What should I add before I can use library. Thanks :)
推荐答案
您必须使用Objective-C而不是Swift导入Pod头文件。因此,如果您想将CocoaPods与Swift一起使用,那么您将混合使用这两种语言。 这是一个很棒的教程,介绍如何实现这一目标。
You have to import the Pod header files using Objective-C and not Swift. So you'll be mixing the two languages if you want to use CocoaPods with Swift. Here's a great tutorial on how to accomplish this.
这篇关于Swift:无法使用Pod文件中的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!