lastMessage
会变为前一条消息。lastMesasge
进行排序,此时会影响您的会话列表顺序。orderKey
进行排序,此时不影响您的会话列表顺序。getHistoryMessage
不能拉取到。getHistoryMessage
能拉取到该条消息。// selectedMsg 为用户选中待删除的消息V2TIMManager.getMessageManager().deleteMessageFromLocalStorage(selectedMsg, new V2TIMCallback() {@Overridepublic void onSuccess() {// 删除本地消息成功}@Overridepublic void onError(int code, String desc) {// 删除本地消息失败}});
// selectedMsg 为用户选中待删除的消息[[V2TIMManager sharedInstance] deleteMessageFromLocalStorage:selectedMessagesucc:^{NSLog(@"删除本地消息成功");} fail:^(int code, NSString *msg) {NSLog(@"删除本地消息失败, code: %d, desc: %@", code, msg);}];
// selectedMessageList 为用户选中待删除的消息列表V2TIMManager.getMessageManager().deleteMessages(selectedMessageList, new V2TIMCallback() {@Overridepublic void onSuccess() {// 删除云端消息成功}@Overridepublic void onError(int code, String desc) {// 删除云端消息失败}});
// selectedMessageList 为用户选中待删除的消息列表NSArray *selectedMessageList = @[selectedMessage1, selectedMessage2];[[V2TIMManager sharedInstance] deleteMessages:selectedMessageListsucc:^{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_;};V2TIMMessageVector messageList = 用户选中待删除的消息列表;auto callback = new Callback;callback->SetCallback([=]() {// 删除云端消息成功delete callback;},[=](int error_code, const V2TIMString& error_message) {// 删除云端消息失败delete callback;});V2TIMManager::GetInstance()->GetMessageManager()->DeleteMessages(messageList, callback);
本页内容是否解决了您的问题?