Search code examples
iosswiftquickblox

How to update a sent message in Quickblox IOS


How do I update a sent QBChatMessage in the server? For e.g. After the message is sent/delivered, how does one update it's text or custom parameters. Also are there parameters that cannot be changed or updated once sent and delivered?

Here's a link to the snippet on Quickblox Android that seems to be doing the same. How is this achieved in IOS?


Solution

  • There is a method in QBRequest:

    /**
     Update existing chat message - mark it as read.
    
     @param message Сhat message to update.
     @param successBlock Block with response instance if request succeded.
     @param errorBlock Block with response instance if request failed.
    
     @return An instance of QBRequest for cancel operation mainly.
     */
    + (QBRequest *)updateMessage:(QBChatMessage *)message
                    successBlock:(nullable void(^)(QBResponse *response))successBlock
                      errorBlock:(nullable QBRequestErrorBlock)errorBlock;
    

    The usage is the same as in android pretty much. Here you can read which fields you can update: http://quickblox.com/developers/Chat#Fields_to_update_2