Closed manohar-techahead closed 1 year ago
Hello @manohar-techahead,
If you encounter Error Code 404 with the message "The operation could not be completed," it typically arises when the dialog.join()
method is improperly utilized. To prevent this error, we suggest reviewing the following steps:
Avoid Multiple Calls: Ensure that you refrain from invoking the dialog.join()
method multiple times in quick succession. To address this, you can employ a check using the dialog.isJoined()
method.
Check Dialog Type: Verify that you are not attempting to join a private dialog. To do this, confirm that dialog.type
is not equal to .private
.
Reconnect After Disconnection: If a disconnection occurs, you must reestablish the connection before engaging with the dialogs.
Below is the revised code snippet with the edits:
extension MyClass: QBChatDelegate { }
// MARK: QBChatConnectionProtocol part of QBChatDelegate
extension MyClass: QBChatConnectionProtocol {
func chatDidConnect() {
joinAll()
}
func chatDidReconnect() {
joinAll()
}
private func joinAll() {
for dialog in dialogs {
if dialog.type != .private, !dialog.isJoined() {
dialog.join()
}
}
}
}
Furthermore, if you encounter Error Code -1002, indicating "You are not connected to chat," this typically indicates a lack of connection to the chat service. To resolve this, ensure that a connection is established using QBChat.instance.isConnected
before transmitting a message. Additionally, for both group and private messages, verify that dialog.isJoined()
returns true
.
Please note that based on your logs, it appears that you might be attempting to join a private dialog of type 3, which could be contributing to the "The operation could not be completed" error.
If you have any more questions or need further assistance, don't hesitate to reach out. Additionally, we'd be thrilled to have you join our QuickBlox Dev Community at https://discord.gg/8D7raPJj. Your presence would be greatly appreciated!
I am trying to send message to a particular dialog but I am getting error sometime The operation couldn’t be completed. (com.quickblox.chat error -1002.). I am attaching the dialog detail here along with QBToken
ID:64de08b832eaaf004ded0100
}