[英]xmpp presence not receiving in delegate methods using iOS and Swift 3
I am using Mongoose. 我正在用猫鼬。 I'm on Ubuntu server and Swift 3 in client side. 我在Ubuntu服务器和客户端的Swift 3上。 I am not able to get the user's presence in delegate function. 我无法在委托函数中获得用户的存在。 I have implemented code like this for Subscripting presence, this is not calling 我已经为下标状态实现了这样的代码,这不是在调用
func xmppRoster(_ sender: XMPPRoster!, didReceivePresenceSubscriptionRequest presence: XMPPPresence!) {
debugPrint("XMPPRoster : didReceivePresenceSubscriptionRequest ")
debugPrint(presence)
sender.acceptPresenceSubscriptionRequest(from: presence.from(), andAddToRoster: true)
}
also when user is sending presence I am not able to get presence of user in this delegate method : 同样,当用户发送状态信息时,我无法在此委托方法中获得用户状态:
func xmppStream(sender: XMPPStream!, didReceivePresence presence: XMPPPresence!) {
debugPrint(presence)
}
Please let me know where I am getting wrong. 请让我知道我哪里出问题了。
The problem is in guessing the correct conversion of method declarations from Objective-C to Swift. 问题在于猜测方法声明从Objective-C到Swift的正确转换。 The following declaration of XMPPFramework callback works in Swift 4: XMPPFramework回调的以下声明在Swift 4中有效:
@objc func xmppStream(_ stream:XMPPStream, didReceivePresence presence:XMPPPresence) {
print("\(presence)")
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.