0

我在 5 分钟后收到错误描述。这是因为 sendbird sdk 的自动重新连接。那么,是否有任何方法可以停止自动连接或减少错误消息的到达时间。

这是我尝试过的,

 let preSendMessage = channel.sendFileMessage(withBinaryData: data!, filename: "demo", type: mimeType! as String, size: UInt((data?.count)!), thumbnailSizes: [thumbnailSize!], data: "", customType: "", progressHandler: nil, completionHandler: { (fileMessage, error) in
                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .milliseconds(150), execute: {

                                let preSendMessage = self.preSendMessages[(fileMessage?.requestId)!]
                                self.preSendMessages.removeValue(forKey: (fileMessage?.requestId)!)

                                if error != nil {
                                    self.resendableMessages[(fileMessage?.requestId)!] = preSendMessage
                                    self.resendableFileData[(preSendMessage as! SBDFileMessage).requestId!] = [
                                        "data": data as AnyObject,
                                        "type": mimeType as AnyObject,
                                    ]

                                    self.chatTableView.reloadData()
                                    DispatchQueue.main.async {
                                        self.chatTableView.scrollToLastRow(animated: true)
                                    }

                                    return
                                }

                                if fileMessage != nil {
                                    self.resendableMessages.removeValue(forKey: (fileMessage?.requestId)!)
                                    self.resendableFileData.removeValue(forKey: (fileMessage?.requestId)!)

                                    self.messages[self.messages.index(of: preSendMessage as! SBDFileMessage)!] = fileMessage!

                                    DispatchQueue.main.async {
                                        self.chatTableView.reloadData()
                                        DispatchQueue.main.async {
                                            self.chatTableView.scrollToLastRow(animated: true)
                                        }
                                    }
                                }
                            })
                        })
4

1 回答 1

1

终于找到解决办法了

显示错误,因为 sendbird 不允许发送包含 15MB 或更大大小的文件消息。

所以,我调整了视频大小,然后发送到 sendbird 服务器,现在它正在工作。

于 2019-05-14T08:08:48.950 回答