gpt4 book ai didi

ios - 如何使用Quickblox IOS更新已发送和已接收消息的读取和传递状态?

转载 作者:行者123 更新时间:2023-12-01 18:45:02 25 4
gpt4 key购买 nike

我已经使用Quickblox实现了一个聊天示例应用程序,并且我遵循了Quckblox提供的SampleChat应用程序(下面提供了网址)。但是我想更新每封邮件的“读取”和“传递”状态。如何实现呢?

  • http://quickblox.com/developers/SimpleSample-chat_users-ios
  • https://github.com/QuickBlox/quickblox-ios-sdk/tree/master/sample-chat

  • 在链接1中,他们解释了一些代码,但我无法实现。

    最佳答案

    您提供的链接中包含readdelivered状态的文档。

    为了使这个答案更明确,有几种方法可以将邮件标记为已读和已传递。对于已交付的标记,只有XMPP方式可用,请使用QBChat的以下方法进行:

    /**
    * Send "delivered" status for message.
    *
    * @param message QBChatMessage message to mark as delivered.
    * @param completion Completion block with failure error.
    */
    - (void)markAsDelivered:(QB_NONNULL QBChatMessage *)message completion:(QB_NULLABLE QBChatCompletionBlock)completion;

    对于读取标记,您可以使用QBRequest方法的任一REST请求:
    /**
    Mark messages as read.

    @note Updates message "read" status only on server.

    @param dialogID dialog ID.
    @param messagesIDs Set of chat message IDs to mark as read. If messageIDs is nil then all messages in dialog will be marked as read.
    @param successBlock Block with response instance if request succeded.
    @param errorBlock Block with response instance if request failed.
    @return An instance, which conforms Cancelable protocol. Use this instance to cancel the operation.
    */
    + (QB_NONNULL QBRequest *)markMessagesAsRead:(QB_NONNULL NSSet QB_GENERIC(NSString *) *)messagesIDs
    dialogID:(QB_NONNULL NSString *)dialogID
    successBlock:(QB_NULLABLE void(^)(QBResponse * QB_NONNULL_S response))successBlock
    errorBlock:(QB_NULLABLE QBRequestErrorBlock)errorBlock;

    或QBChat的XMPP方法:
    /**
    * Send "read" status for message and update "read" status on a server
    *
    * @param message QBChatMessage message to mark as read.
    * @param completion Completion block with failure error.
    */
    - (void)readMessage:(QB_NONNULL QBChatMessage *)message completion:(QB_NULLABLE QBChatCompletionBlock)completion;

    如果您需要一个“实时”示例,无论如何都应更接近示例和文档。

    关于ios - 如何使用Quickblox IOS更新已发送和已接收消息的读取和传递状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36835872/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com