代码:
if try self.xmppStream!.authenticateWithPassword(password) {
出错:
SwiftXMPP/AppDelegate.swift:147:20: Ambiguous reference to member ‘xmppStream’
其中有3处定义:
var xmppStream: XMPPStream? func xmppStream(sender: XMPPStream?, didReceiveMessage: XMPPMessage?) { if let message:XMPPMessage = didReceiveMessage { 。。。 } } func xmppStream(sender: XMPPStream?, didReceivePresence: XMPPPresence?) { // println("didReceivePresence") if let presence = didReceivePresence { 。。。 }
即:
此处的变量:xmppStream
除了定义的之外,还有2个函数也叫这个名字:
好像是属于对应的变量的setter的函数
搜:
swift Ambiguous reference to member ‘xmppStream’
swift Ambiguous reference xmppStream
swift didReceivePresence didReceiveMessage
还是没有找到有价值的参考,算了,搞不懂。
直接给变量重命名:
最后改为了:
do{ try curXmppStream!.authenticateWithPassword(password) print("authentification successful") }catch{ print(error) }
即可通过编译。
转载请注明:在路上 » [已解决]swift出错:Ambiguous reference to member xmppStream