gpt4 book ai didi

ios - 在 iOS 中通过 XMPP MessageArchiving 保存 XMPP 多用户聊天消息

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:09:14 26 4
gpt4 key购买 nike

我正在使用 XMPP 在 iOS 中开发一个聊天应用程序。到目前为止,我已经成功地实现并测试了一个单用户聊天场景,即发送、接收、保存和检索消息。

现在面临的问题是,现在在处理多用户聊天场景时,他们收到了它,但无法使用 XMPP MessageArchiving 保存它们,因此也无法检索它们。

有人经历过这个过程/问题吗?

提前致谢

最佳答案

groupchat 类型的消息可以保存在 XMPPRoom.xcdatamodel 中,您需要在 xmpp 设置中初始化 XMPPRoomCoreDataStorage,例如:

XMPPRoomCoreDataStorage *xmppRoomStorage = [[XMPPRoomCoreDataStorage alloc] init];

因此,此类实现了一种方法,可将所有消息 ROOM 插入正确的数据模型中(在我们的示例中,所有传出和传入消息都保存在 XMPPRoom.xcdatamodel 中)。

- (void)insertMessage:(XMPPMessage *)消息
传出:(BOOL)isOutgoing
forRoom:(XMPPRoom *)房间
流:(XMPPStream *)xmppStream

更多 XEP-0045 信息 http://xmpp.org/extensions/xep-0045.html

关于ios - 在 iOS 中通过 XMPP MessageArchiving 保存 XMPP 多用户聊天消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18202484/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com