最后的用户

问题描述:

活动我与XMPP架构的iOS库我的聊天应用程序的工作,让有关的用户上次活动它提供了一些问题,“禁止”错误最后的用户

这里是我的代码,以获得用户的上次活动

let senderJID = XMPPJID.init(string:detailVC.bareJidStr) 
let lastAcivity = appDelegate.lastActivity?.sendQuery(to: senderJID, withTimeout: XMPPStreamTimeoutNone) 
print(lastAcivity as Any) 

public func xmppLastActivity(_ sender: XMPPLastActivity!, didReceiveResponse response: XMPPIQ!) { 

// Extract the seconds from response IQ 
    let time = response.lastActivitySeconds() 
    print("time in seconds \(time)") 
    print("response \(response))")} 

error:-> <error code="403" type="auth"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></forbidden></error> 
+0

您需要通过认证参数。 – iParesh

+0

谢谢,但如何传递参数呢?我可以举个例子吗? – Bucket

用户需要在名册中,并有权查看其他用户的存在。这是在最近活动XEP解释说:http://www.xmpp.org/extensions/xep-0012.html#online

如果请求实体未被授权查看用户的存在 信息(通过呈现订阅通常在XMPP IM定义),用户的服务器不能交付智商 - 获得一个可用的 资源,但是必须返回一个错误,以响应上一个活动请求的 。