lastMessage
in the conversation will become empty, and:lastMessage
is used for sorting, the sequence in the conversation list will be affected.orderKey
is used for sorting, the sequence in the conversation list will not be affected.
For more information, see Conversation List.V2TIMManager.getMessageManager().clearC2CHistoryMessage(userID, new V2TIMCallback() {@Overridepublic void onSuccess() {// One-to-one messages cleared successfully}@Overridepublic void onError(int code, String desc) {// Failed to clear one-to-one messages}});
[V2TIMManager.sharedInstance clearC2CHistoryMessage:userIDsucc:^{NSLog(@"One-to-one messages cleared successfully");} fail:^(int code, NSString *desc) {NSLog(@"Failed to clear one-to-one messages, code: %d, desc: %@", code, desc);}];
class Callback final : public V2TIMCallback {public:using SuccessCallback = std::function<void()>;using ErrorCallback = std::function<void(int, const V2TIMString&)>;Callback() = default;~Callback() override = default;void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {success_callback_ = std::move(success_callback);error_callback_ = std::move(error_callback);}void OnSuccess() override {if (success_callback_) {success_callback_();}}void OnError(int error_code, const V2TIMString& error_message) override {if (error_callback_) {error_callback_(error_code, error_message);}}private:SuccessCallback success_callback_;ErrorCallback error_callback_;};auto callback = new Callback;callback->SetCallback([=]() {// One-to-one messages cleared successfullydelete callback;},[=](int error_code, const V2TIMString& error_message) {// Failed to clear one-to-one messagesdelete callback;});
V2TIMManager.getMessageManager().clearGroupHistoryMessage(GroupID, new V2TIMCallback() {@Overridepublic void onSuccess() {// Group messages cleared successfully}@Overridepublic void onError(int code, String desc) {// Failed to clear group messages}});
[[V2TIMManager sharedInstance] clearGroupHistoryMessage:groupIDsucc:^{NSLog(@"Group messages cleared successfully");} fail:^(int code, NSString *desc) {NSLog(@"Failed to clear group messages, code: %d, desc: %@", code, desc);}];
class Callback final : public V2TIMCallback {public:using SuccessCallback = std::function<void()>;using ErrorCallback = std::function<void(int, const V2TIMString&)>;Callback() = default;~Callback() override = default;void SetCallback(SuccessCallback success_callback, ErrorCallback error_callback) {success_callback_ = std::move(success_callback);error_callback_ = std::move(error_callback);}void OnSuccess() override {if (success_callback_) {success_callback_();}}void OnError(int error_code, const V2TIMString& error_message) override {if (error_callback_) {error_callback_(error_code, error_message);}}private:SuccessCallback success_callback_;ErrorCallback error_callback_;};auto callback = new Callback;callback->SetCallback([=]() {// Group messages cleared successfullydelete callback;},[=](int error_code, const V2TIMString& error_message) {// Failed to clear group messagesdelete callback;});V2TIMManager::GetInstance()->GetMessageManager()->ClearGroupHistoryMessage(groupID, callback);
Was this page helpful?