1.XMPPMessageArchiving_Message_CoreDataObject 先从这个表获取所有聊天数据
2.XMPPMessageArchiving_Contact_CoreDataObject *contact_coredataobject = [[SXXMPPTools sharedXMPPTools].xmppMessageArchivingCoreDataStorage contactForMessage:message];
再用这个 方法 获取最近联系人的聊天数据
3.删除最近好友的聊天数据
//获取消息表上下文
NSManagedObjectContext *ctx = [SXXMPPTools sharedXMPPTools].xmppMessageArchivingCoreDataStorage.mainThreadManagedObjectContext;
//遍历所有消息 如果消息ID是当前CELL ID 删除
XMPPMessageArchiving_Message_CoreDataObject *message = [self.fetchedResultsController objectAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
if ([message.bareJid.user isEqualToString:cell.chattopLabel.text]) {
[ctx deleteObject:message];
}
还有个问题 就是 加了查询条件之后 上下文改变 怎么没有回调 不加就有回调