tencent cloud



Last updated: 2023-07-17 14:25:55


    You can call findMessages to query a local message based on the messageID. Note that:
    1. Only local messages can be queried, for example, received messages or historical messages pulled by API.
    2. Audio-video group (AVChatRoom) messages cannot be queried, as they are not saved locally.

    Querying a Local Message

    Call the findMessages API (Android / iOS and macOS / Windows) to query a local message.
    Sample code:
    iOS and macOS
    V2TIMManager.getMessageManager().findMessages(messageIDList, new V2TIMValueCallback<List<V2TIMMessage>>() {
    public void onSuccess(List<V2TIMMessage> v2TIMMessages) {}
    public void onError(int code, String desc) {}
    [V2TIMManager.sharedInstance findMessages:messageIDList
    succ:^(NSArray<V2TIMMessage *> *msgs) {
    // Messages queried successfully
    } fail:^(int code, NSString *desc) {
    // Failed to query the messages
    template <class T>
    class ValueCallback final : public V2TIMValueCallback<T> {
    using SuccessCallback = std::function<void(const T&)>;
    using ErrorCallback = std::function<void(int, const V2TIMString&)>;
    ValueCallback() = default;
    ~ValueCallback() override = default;
    void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {
    success_callback_ = std::move(success_callback);
    error_callback_ = std::move(error_callback);
    void OnSuccess(const T& value) override {
    if (success_callback_) {
    void OnError(int error_code, const V2TIMString& error_message) override {
    if (error_callback_) {
    error_callback_(error_code, error_message);
    SuccessCallback success_callback_;
    ErrorCallback error_callback_;
    auto callback = new ValueCallback<V2TIMMessageVector>{};
    [=](const V2TIMMessageVector& messageVector) {
    // Messages queried successfully
    delete callback;
    [=](int error_code, const V2TIMString& error_message) {
    // Failed to query the messages
    delete callback;
    V2TIMManager::GetInstance()->GetMessageManager()->FindMessages(messageIDList, callback);
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support