问题描述
//插入图片消息体 NSDictionary *imageDic = @{EMMessageBodyAttrKeySecret:dict[@"secret"], EMMessageBodyAttrKeySize:@{EMMessageBodyAttrKeySizeWidth:@640,EMMessageBodyAttrKeySizeHeight:@1136}, EMMessageBodyAttrKeyFileName:dict[@"filename"], EMMessageBodyAttrKeyType:EMMessageBodyAttrTypeImag, EMMessageBodyAttrKeyUrl:dict[@"url"], EMMessageBodyAttrKeyFileLength:@178212}; EMImageMessageBody *imageBody = [EMImageMessageBody imageMessageBodyFromBodyDict:imageDic forChatter:_chatter]; EMMessage *image = [[EMMessage alloc] initMessageWithID:dict[@"msg_id"] sender:dict[@"from_user"] receiver:_chatter bodies:@[imageBody]]; image.timestamp = [dict[@"timestamp"] longLongValue]; image.isReadAcked = NO; image.deliveryState = eMessageDeliveryState_Delivered; image.isRead = NO; image.isGroup = self.isChatGroup; image.conversationChatter = _chatter; BOOL b; // [[EaseMob sharedInstance].chatManager insertMessageToDB:messagetext]; b = [[EaseMob sharedInstance].chatManager insertMessageToDB:image append2Chat:YES]; DLog(@"图片返回类型--%hhd",b);打印为0
解决方案
失败的话,要么是消息构造的不对,或者就是重复插入会失败。检查下吧。
解决方案二:
怎么查看是否重复插入,,但我的文字消息体能插入进去
解决方案三:
确实是重复插入了