2016-11-25 32 views
0

活動我與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

回答

0

用戶需要在名冊中,並有權查看其他用戶的存在。這是在最近活動XEP解釋說:http://www.xmpp.org/extensions/xep-0012.html#online

如果請求實體未被授權查看用戶的存在 信息(通過呈現訂閱通常在XMPP IM定義),用戶的服務器不能交付智商 - 獲得一個可用的 資源,但是必須返回一個錯誤,以響應上一個活動請求的 。