Messagekit: Strange behaviour of send button

Created on 18 Jul 2019  路  5Comments  路  Source: MessageKit/MessageKit

Hi.
Guys something strange is happening here.
Little bit of tech spec:
MessageKit from branch 3.0.0-swift5
iOS - 11 and above
Swift 5
Testing device iPhone XS.
Now about glitch

this is my code in viewDidLoad

        messageInputBar.delegate = self
        messagesCollectionView.messagesDataSource = self
        messagesCollectionView.messagesLayoutDelegate = self
        messagesCollectionView.messagesDisplayDelegate = self

and extension for protocol

extension ChatViewController:  InputBarAccessoryViewDelegate {

    func messageInputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
        inputBar.inputTextView.text = ""
    }

}

But. Send button just don't trigger protocol method in my ViewController. While I tried figure it out I can clearly see that this line is being executed as expected
$0.inputBarAccessoryView?.didSelectSendButton() (InputBarAccessoryView.swift line 159).
So I'm a bit lost in which direction I should look at to solve this?

Most helpful comment

I know this issue is closed, but I think it should be discussed...
I had the exact same problem, I did upgrade from previous version and I didn't know about the refactor of the name
The method name has been changed to
func **inputBar**(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {}

The method is optional, so the compiler didn't complain...I think this method shouldn't be optional, why should someone have a chat and don't enable message sending?

All 5 comments

I know this issue is closed, but I think it should be discussed...
I had the exact same problem, I did upgrade from previous version and I didn't know about the refactor of the name
The method name has been changed to
func **inputBar**(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {}

The method is optional, so the compiler didn't complain...I think this method shouldn't be optional, why should someone have a chat and don't enable message sending?

Yeah. I figured it out right exact after this issue was opened. I thought that it could be some sort of bug because it's not main branch yet

Guys, you saved my day!! I got stuck on this for a while also. Thank you so much for sharing this!!! :)

Hey guys! I'm still having the same issue as you all are having, but I am not understanding the solution. I keep pressing send, but the message bubble is not appearing. What do you mean the method name has been changed? See below for my code.
Screen Shot 2020-06-13 at 12 35 13 PM

Never mind! Figured it out. * input bar * is just InputBar. Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings