我正在使用messagekit和firebase制作具有三个不同消息传递选项卡的应用程序。每个messagekit视图都装入一个容器中。我的问题是Messagekit输入栏未显示。我在下面添加了viewDidLoad()函数和input函数以及其他图片。让我知道您是否有任何想法,我已经尝试过很多不同的论坛。
This is the issue in the iPhone simulator
override func viewDidLoad() {
super.viewDidLoad()
self.title = user2Name ?? "Chat"
navigationItem.largeTitleDisplayMode = .never
maintainPositionOnKeyboardFrameChanged = true
messageInputBar.delegate = self
messagesCollectionView.messagesDataSource = self
messagesCollectionView.messagesLayoutDelegate = self
messagesCollectionView.messagesDisplayDelegate = self
let db2 = Firestore.firestore().collection("Users").document(currentUser.uid)
db2.getDocument { (document, error) in
if let document = document, document.exists {
let dataDescription = document.data()!["matches"]! as! [Any]
self.user2UID = dataDescription[0] as! String
self.loadChat()
} else {
print("Document does not exist")
self.loadChat()
}
}
}
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
let message = Message(id: UUID().uuidString, content: text, created: Timestamp(), senderID: currentUser.uid, senderName: currentUser.displayName!)
//messages.append(message)
insertNewMessage(message)
save(message)
inputBar.inputTextView.text = ""
messagesCollectionView.reloadData()
messagesCollectionView.scrollToBottom(animated: true)
}