lastMessage
会变为空,那么:lastMesasge
进行排序,此时会影响您的会话列表顺序。orderKey
进行排序,此时不影响您的会话列表顺序。
详情请参考 会话列表。V2TIMManager.getMessageManager().clearC2CHistoryMessage(userID, new V2TIMCallback() {@Overridepublic void onSuccess() {// 清空单聊消息成功}@Overridepublic void onError(int code, String desc) {// 清空单聊消息失败}});
[V2TIMManager.sharedInstance clearC2CHistoryMessage:userIDsucc:^{NSLog(@"清空单聊消息成功");} fail:^(int code, NSString *desc) {NSLog(@"清空单聊消息失败, 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([=]() {// 清空单聊消息成功delete callback;},[=](int error_code, const V2TIMString& error_message) {// 清空单聊消息失败delete callback;});
V2TIMManager.getMessageManager().clearGroupHistoryMessage(GroupID, new V2TIMCallback() {@Overridepublic void onSuccess() {// 清空群聊消息成功}@Overridepublic void onError(int code, String desc) {// 清空群聊消息失败}});
[[V2TIMManager sharedInstance] clearGroupHistoryMessage:groupIDsucc:^{NSLog(@"清空群聊消息成功");} fail:^(int code, NSString *desc) {NSLog(@"清空群聊消息失败, 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([=]() {// 清空群聊消息成功delete callback;},[=](int error_code, const V2TIMString& error_message) {// 清空群聊消息失败delete callback;});V2TIMManager::GetInstance()->GetMessageManager()->ClearGroupHistoryMessage(groupID, callback);
本页内容是否解决了您的问题?