3

I am developing an chat base application with the help of QuickBlox.

There is an Api that returns chat dialogs where the last sent message and unread-messages count comes.

My problem is to mark messages as read. For this i got the working code like

[QBChat markMessagesAsRead:arrMessages dialogID:dialogId delegate:self]; // arrMessages is the array of message ids

It works well but sometime what happens some of message gets skipped and it always comes as unread messages in QBChatDialog

So My question is what should i do to mark all messages of it as read.

Or

How can i get those particular skipped messages that are unread. As it call the api to get messages it give only last one not that particular skipped.

haresh
  • 486
  • 3
  • 18

1 Answers1

3

You can mark all messages as read just passing nil as the array parameter

[QBChat markMessagesAsRead:nil dialogID:dialogId delegate:self];

In that case ALL your messages should be marked as read

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • Is there any way in QuickBlox to get only unread messages like if i just missed 5 messages and that are not the last so can i able to only get those 5 unread messages. – haresh Jan 28 '15 at 12:37
  • 1
    @ Igor, with latest quickblox sdk for iOS updates it changes the way to request for markMessagesRead in `QBRequest` like this, `+ (QBRequest *)markMessagesAsRead:(NSSet *)messageIDs dialogID:(NSString *)dialogID successBlock:(void(^)(QBResponse *response))successBlock errorBlock:(QBRequestErrorBlock)errorBlock`. But if I pass nil in place of `NSSet` it goes into error. With following message `Error reasons:{ code = ""; message = "Resource not found";}` – Hemang Apr 17 '15 at 05:59