Quickblox messaging fetch last n messages

后端 未结 2 1555
盖世英雄少女心
盖世英雄少女心 2021-01-22 08:51

I\'m using the Quickblox iOS SDK for instant messaging in my app. When a user logs in I retrieve the list of messages. I am trying to retrieve the last N messages. I use extende

相关标签:
2条回答
  • 2021-01-22 08:57

    I was getting the same issue in Android .

    Solved it as following . All you have to do is add a parameter in requestbuilder sortDesc("date_sent");

    QBDialog dlg=new QBDialog(str_dialogid);
        QBRequestGetBuilder requestBuilder = new QBRequestGetBuilder();
        requestBuilder.setLimit(10);
        requestBuilder.sortDesc("date_sent");
    
    0 讨论(0)
  • 2021-01-22 09:13

    //Try this out:

    NSMutableDictionary *extendedRequest = [NSMutableDictionary new];
    NSDate *now = [NSDate date];
    extendedRequest[@"date_sent[lte]"]= @([now timeIntervalSince1970]);
    extendedRequest[@"sort_desc"]= @"date_sent";
    
    //get the most recent 50 messages
    extendedRequest[@"limit"] = @(50);
    [QBChat messagesWithDialogID:self.dialog.ID extendedRequest:extendedRequest delegate:self];
    
    0 讨论(0)
提交回复
热议问题