【问题标题】:How to fetch message with timestamp XMPP iOS?如何获取带有时间戳 XMPP iOS 的消息?
【发布时间】:2016-08-04 08:51:13
【问题描述】:

我正在使用 Openfire、XMPP、iOS 的“GroupChat”。

我想在定义的时间后获取历史记录,所以我用谷歌搜索它,我发现它使用“Since”。

  NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
    [history addAttributeWithName:@"since" stringValue:@"2016-07-04T09:06:38.588Z"];

    [xmppRoom joinRoomUsingNickname:self.xmppStream.myJID.user
                            history:history
                           password:nil];

但它从表中获取所有记录,我只想在定义的时间后记录。 我也使用了明火时间戳,但它没有用。

我如何随时间获取历史记录?

【问题讨论】:

    标签: ios objective-c xmpp openfire


    【解决方案1】:

    [XMPP 扩展-0045]: http://xmpp.org/extensions/xep-0045.html

    7.2.15 管理讨论历史

        from='hag66@shakespeare.lit/pda'
        id='n13mt3l'
        to='coven@chat.shakespeare.lit/thirdwitch'>
      <x xmlns='http://jabber.org/protocol/muc'>
        <history since='2015-01-01T00:00:00Z'/>
      </x>
    </presence>
    

    还要检查房间默认值,例如您可以获取的消息数量或您的服务器能够获取的消息数量。

    【讨论】:

    • 如何在 ios 中设置零时间戳?
    • 它将时间戳转换为日期..但它需要将当前日期转换为零时间戳..如何实现?
    猜你喜欢
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    • 2015-04-19
    • 2020-11-18
    • 2018-02-28
    • 2020-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多