【问题标题】:Last activity of user用户的最后活动
【发布时间】:2016-11-25 13:22:37
【问题描述】:

我正在为我的聊天应用程序使用 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>

【问题讨论】:

  • 需要传入Authentication参数。
  • 谢谢,但是如何传递参数呢?可以举个例子吗
  • @Bucket 你有解决办法吗?
  • @Bucket 你找到解决办法了吗?

标签: ios swift xmpp xmppframework


【解决方案1】:

用户需要在名册中并获得授权才能看到其他用户的存在。上次活动 XEP 中对此进行了解释:http://www.xmpp.org/extensions/xep-0012.html#online

如果请求实体无权查看用户的状态 信息(通常通过 XMPP 中定义的在线订阅 IM),用户的服务器不得将 IQ-get 传递给可用的 资源,但必须返回错误以响应 最后一个活动请求。

【讨论】:

  • 我如何订阅在线状态?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多