chatDidReceiveMessage:未调用 [英] chatDidReceiveMessage: not called
问题描述
我在私人和小组公开聊天的应用程序中使用QuickBlox。
我已使用QBChat的 addDelegate:方法添加了委托,并使用委托的 chatDidReceiveMessage:方法发送消息并获取传入消息。
私人聊天时一切正常,公共组 chatDidReceiveMessage:未触发,但我在日志中看到传入消息:
I use QuickBlox in application with private and group public chats. I've added delegate with QBChat's addDelegate: method, send messages and get incoming messages in delegate's chatDidReceiveMessage: method. While with private chats all is working fine, with public groups chatDidReceiveMessage: not triggered, but I see incoming message in log:
Message RCV: <message xmlns="jabber:client" id="5677e315a28f9a1aa10007df" to="7084298-30903@chat.quickblox.com/7B2CAB4D-1BCE-44EF-B6E4-2B4E8C5D4DF9" type="groupchat" from="30903_5671612da28f9abe16003e94@muc.chat.quickblox.com/7106776"><body>2</body><extraParams xmlns="jabber:client"><date_sent>1450697496.373676</date_sent><dialog_id>5671612da28f9abe16003e94</dialog_id></extraParams><delay xmlns="urn:xmpp:delay" stamp="2015-12-21T11:31:34Z"/></message>
私人和公共聊天的消息发送代码相同:
Message sending code for private and public chats is the same:
[QBRequest createMessage:message successBlock:^(QBResponse * _Nonnull response, QBChatMessage * _Nonnull createdMessage) {
//
** success callback here **
[dialog sendMessage:createdMessage completionBlock:NULL];
//
} errorBlock:^(QBResponse * _Nonnull response) {
//
// ** error callback here**
}];
是错误还是我错过了邮件发送的某些内容?
Is it a bug or I missed something about messages sending?
推荐答案
好,知道了。
要捕获张贴到房间的消息,必须使用其他代表的方法- chatRoomDidReceiveMessage:fromDialogID:。我被 chatDidReceiveMessage:方法的名称迷住了,因为关于此方法的文档只说了当从QBChat收到新消息时触发。
To catch messages, posted to rooms, you must use another delegate's method - chatRoomDidReceiveMessage:fromDialogID:. I was fooled by chatDidReceiveMessage: method's name, since documentation on this one says nothing except "fired when new message was received from QBChat".
这篇关于chatDidReceiveMessage:未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!