All one-one chat is send with Message Type as Chat. Thus the Message Archiving technique (shown below) worked fine for me to save/retrieve chat history.
// S
You can easily get archive messages from xmpp core database. Use Below code.
XMPPMessageArchivingCoreDataStorage *_xmppMsgStorage = [XMPPMessageArchivingCoreDataStorage sharedInstance];
NSManagedObjectContext *moc = [_xmppMsgStorage mainThreadManagedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"XMPPMessageArchiving_Message_CoreDataObject"
inManagedObjectContext:moc];
NSFetchRequest *request = [[NSFetchRequest alloc]init];
[request setEntity:entityDescription];
//[request setFetchLimit:20];
NSError *error;
NSString *predicateFrmt = @"bareJidStr == %@";
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFrmt, [NSString stringWithFormat:@"%@%@",GroupName,GROUP_CHAT_DOMAIN]];
request.predicate = predicate;
NSArray *messages = [moc executeFetchRequest:request error:&error];