2
調用非功能型的價值「OnAckCallback」我有工作的函數:不能在我的<code>Swift2</code>在雨燕3.0
func connectToServerWithNickname(_ nickname: String) {
print("CONNECTING TO SOCKET SERVER \(nickname)")
socket.emitWithAck("connectUser", nickname)(timeoutAfter: 3) { data in
print("CONNECTED FOR SURE")
}
}
,但是,當我提出我的整個代碼Swift3
,我得到錯誤:
cannot call value of non-function type 'OnAckCallback'
這種方法來自socket.io
庫,它看起來有這樣的:
/// Sends a message to the server, requesting an ack. Use the onAck method of SocketAckHandler to add
/// an ack.
public func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
return emitWithAck(event, with: items)
}
/// Same as emitWithAck, but for Objective-C
public func emitWithAck(_ event: String, with items: [Any]) -> OnAckCallback {
return createOnAck([event] + items)
}
private func createOnAck(_ items: [Any]) -> OnAckCallback {
currentAck += 1
return OnAckCallback(ackNumber: currentAck, items: items, socket: self)
}
我該如何修復我的代碼才能編譯?