iOS 给别人发消息,造成持续循环
EMChatText *text = [[EMChatText alloc] initWithText:@"消息内容"];
EMTextMessageBody *body = [[EMTextMessageBody alloc] initWithChatObject:text];
EMMessage *msg = [[EMMessage alloc] initWithReceiver:@"receiverId" bodies:@[body]];
[[EaseMob sharedInstance].chatManager asyncSendMessage:msg progress:nil];
把上面发消息的代码写在EaseMessageViewController.m类- (void)didSendMessage:(EMMessage *)message error:(EMError *)error发送方法里面,造成持续循环发送,求解
EMTextMessageBody *body = [[EMTextMessageBody alloc] initWithChatObject:text];
EMMessage *msg = [[EMMessage alloc] initWithReceiver:@"receiverId" bodies:@[body]];
[[EaseMob sharedInstance].chatManager asyncSendMessage:msg progress:nil];
把上面发消息的代码写在EaseMessageViewController.m类- (void)didSendMessage:(EMMessage *)message error:(EMError *)error发送方法里面,造成持续循环发送,求解
没有找到相关结果
已邀请:
3 个回复
[已注销]
@Method
@brief 发送消息后的回调
@discussion
@param message 已发送的消息对象
@param error 错误信息
@result
*/
- (void)didSendMessage:(EMMessage *)message
error:(EMError *)error;
这个方法就是发送完消息就会调用的回调方法,在该方法中再调用发送消息的方法必然会造成死循环。
小江 - 90后
[已注销]
conversationType:(EMConversationType)conversationType;
使用该方法创建会话,或直接在创建消息的时候设置接收者
http://docs.easemob.com/doku.php?id=start:300iosclientintegration:40emmsg