0

I am developing iMessage Extension, but didSelect(_ message: MSMessage, conversation: MSConversation) not getting called always, sometimes it called. But not getting when it calls and when not. According to my observation after launch of extension, on first time tap on message method will call, but after that method not getting called.I want to track every tap on message.

Is there any way to identify tap on message in iMessage Extension?

override func didSelect(_ message: MSMessage, conversation: MSConversation) {

    super.didSelect(message, conversation: conversation)
    isExpandingFromMessage = true

}

Below is image from my iMessage Extension and want to identify event when user tap on message.

enter image description here

technerd
  • 14,144
  • 10
  • 61
  • 92

1 Answers1

1

The method is called "didSelect", not "didTap", so it only fires when you initially select the message. You can find this behavior defined at https://developer.apple.com/reference/messages/msmessagesappviewcontroller

func didSelect(MSMessage, conversation: MSConversation)

Invoked after the system updates the conversation’s selectedMessage property in response to the user selecting a message object in the transcript."

If you want to track all taps on the message, you might try adding a UITapGestureRecognizer to the message view.

Chris Allwein
  • 2,498
  • 1
  • 20
  • 24
  • Yes, you are right, `didSelect` will only call, once `selectedMessage` get updated. – technerd Oct 13 '16 at 05:34
  • But we can not add gesture on `MSMessage`. – technerd Oct 13 '16 at 06:17
  • So how do you detect when the user selected the same message multiple times? I only get the event once, the first time. After that, no event is called, and I have no way of knowing to perform the same action in the app, that was performed the first time the message was selected. – FranticRock Sep 17 '17 at 20:32