OGeek|极客世界-中国程序员成长平台

标题: ios - Quickblox chatRoomDidReceiveMessage 没有调用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 12:39
标题: ios - Quickblox chatRoomDidReceiveMessage 没有调用

我遇到了一个问题,我在群组类型 QBChatDialogTypeGroup 中聊天时没有收到消息。 我正在使用下面的代码消息发送成功并收到通知其他群组成员,但是群组聊天 View 中的用户无法调用这些方法然后收到消息。

- (void)chatRoomDidReceiveMessageQBChatMessage *)message fromRoomJIDNSString *)roomJID{

}

- (void)chatDidNotSendMessageQBChatMessage *)message toRoomJidNSString *)roomJid errorNSError *)error{

}


QBChatDialog *groupChatDialog = qbchatDialog;

[[QBChat instance] delegates];


QBChatMessage *message = [QBChatMessage markableMessage];
[message setText:txt];
[message setDateSent: [NSDate date]];
message.markable =YES;



message.senderNick=[[NSUserDefaults standardUserDefaults] valueForKey"name"];

NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"save_to_history"] = @YES;
[message setCustomParameters:params];


[groupChatDialog joinWithCompletionBlock:^(NSError * _Nullable error) {

[privateChatDialog sendMessage:message completionBlock:^(NSError * _Nullable error) {

     }];



Best Answer-推荐答案


请使用 addDelegate: 方法订阅聊天通知:

[[QBChat instance] addDelegate:self];

并实现 QBChatDelegate 协议(protocol)方法(可选):

- (void)chatDidReceiveMessageQB_NONNULL QBChatMessage *)message;
- (void)chatDidReceiveSystemMessageQB_NONNULL QBChatMessage *)message;
- (void)chatRoomDidReceiveMessageQB_NONNULL QBChatMessage *)message fromDialogIDQB_NONNULL NSString *)dialogID;

Create new dialog文档。

关于ios - Quickblox chatRoomDidReceiveMessage 没有调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34842562/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4