I am doing an XMPP iPhone chat application for the first time (using XMPP framework from gitHub). On that I can able to send and receive messages, but my problem is :
Now I am on the chatting page, on that I have used a method to fetch all the archived messages from XMPPMessageArchivingCoreDataStorage and displaying it to the user. When a new message arrives "xmppStream: didReceiveMessage:" method will get called and on that I have posted a notification. Receiver of that notification is set on the chatting page. So when a new message notification arrives I use the same previous method to fetch the archived messages and then display it to the user. I have done this for showing the new message to the user. But my problem is that when Message 1 arrives it's not listing, then Message 2 arrives Message 1 listing, when Message 3 arrives Message 1 and 2 are listing and so on. But some times it works fine.
My doubts are :
- Is this the correct way to display new messages ?
- If yes, why the last message is not archiving some times ?
Thanks in advance...