我想在我的 swift 项目中使用 SimplePing
。当我尝试这样做时(受此 example 的第二个快速回答的启发),我收到此错误 Use of undeclared type "SimplePing"
和 Use of undeclared type "SimplePingDelegate"
。我没有找到 SimplePing 的 pod,而且它在 iOS 中默认不存在。
如何导入?
最佳答案
SimplePing 不是内置库,目前没有可用的 pod。如果您想使用该库,请继续从 Apple 下载 SimplePing.h
和 SimplePing.m
只需将其拖放到您的项目中即可。
由于您的项目是用 Swift
编写的,而库是在 Objective C
中,因此您需要使用桥接 header 将库公开给您的 swift 类。
您可以在以下位置阅读更多相关信息:Objective C & Swift in Same Project
关于ios - 使用未声明的类型 "SimplePing",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39656796/