我正在尝试使用 Swift 2 中的 SocketRocket(一个 Objective-C pod)。我创建了一个桥接头。
这是我正在尝试的:
import SocketRocket
class WS3: NSObject, SRWebSocketDelegate {
func websocket(webSocket: SRWebSocket!,
didReceiveMessage message: AnyObject!) -> Void {
}
}
编译器错误信息是:
Error:Error:Build failed with 1 error and 0 warnings in 1s 685ms
/Users/jao/Desktop/consulting/blackring/Black Ring/Black Ring/WS3.swift
Error:Error:line (8)type 'WS3' does not conform to protocol 'SRWebSocketDelegate'
x86_64
Note:Note:class WS3: NSObject, SRWebSocketDelegate {
Note:Note: ^
Note:Note: public func webSocket(webSocket: SRWebSocket!, didReceiveMessage message: AnyObject!)
Note:Note: ^
SocketRocket.SRWebSocketDelegate
Note:Note:protocol requires function 'webSocket(_:didReceiveMessage:)' with type '(SRWebSocket!, didReceiveMessage: AnyObject!) -> Void'
在我看来,我正在做错误消息所说的我应该做的事情。我究竟做错了什么?