assuming your message objects have a from
relationshit to a User
entity.
As simple as adding (before executing the request):
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"from = %@ OR from = %@",selfUser,otherUser];
Where selfUser
and otherUser
are User
core data managed objects or managed object IDs of users.
if you use a field identifier (highly not recomended):
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"bareJID.bare = %@ OR bareJID.bare = %@",selfUser.jid,otherUser.jid];
You might want to read THIS