ios从服务器导出历史记录,我保全在demo数据库不成功
//插入图片消息体
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
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
没有找到相关结果
已邀请:
3 个回复
Half12345
赞同来自: lizg
不轻易言弃
不轻易言弃