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

标签 ios core-data xmpp xmppframework

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

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

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

提前谢谢

最佳答案

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

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

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

- (void)insertMessage:(XMPPMessage *)消息 传出:(BOOL)正在传出 房间:(XMPP房间 *)房间 流:(XMPPStream *)xmppStream

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

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

相关文章:

ios - swift 2.2 : Value of type 'Element' (aka 'AnyObject' ) has no member 'objectID'

Java - 尝试使用 bosh 预绑定(bind) converse.js 但无法获取 sid 并摆脱...使用 smack bosh

javascript - 如何通过网络套接字构建 xmpp 网络聊天应用程序,如 gtalk

python - 使用 django 创建 gtalk 类型的应用程序

ios - 带有圆角和投影的 Swift uiview 不起作用

iphone - 平移 View 和旋转它的问题

ios - Swift - 服务器响应 "unsupported_grant_type"

ios - 在 iOS 版 Chrome 中下载 Apple Pass 时出错

ios5 - 使用 CaseInsensitiveCompare 的多个排序描述符对核心数据进行排序

ios - RestKit POSTing multipartFormRequest 与字典参数会在数据中添加反斜杠