iOS 的 XMPPFramework,didReceiveTrust 实现

XMPPFramework for iOS, didReceiveTrust implementation

我正在尝试在 XMPPStreamDelegate 中实现简单的 didReceiveTrust,但是 Xcode 在方法定义上显示警告:

func xmppStream(_ sender: XMPPStream!, didReceiveTrust trust: SecTrust, completionHandler: XMPPStreamCompletionHandler) {
    completionHandler(true)
}

警告如下:

Instance method 'xmppStream(sender:didReceiveTrust:completionHandler:)' nearly matches optional requirement 'xmppStream(_:didReceive:completionHandler:)' of protocol 'XMPPStreamDelegate'

在测试应用程序时,我得到以下输出:

2018-06-12 23:10:11:239 MyMessages[55145:3561831] XMPPStream: Stream secured with (GCDAsyncSocketManuallyEvaluateTrust == YES), but there are no delegates that implement xmppStream:didReceiveTrust:completionHandler:. This is likely a mistake.

请帮忙

以下函数定义按预期工作:

func xmppStream(_ sender: XMPPStream?, didReceive trust: SecTrust?, completionHandler: @escaping (_ shouldTrustPeer: Bool) -> Void) {
    completionHandler(true)
}