I have designed an iMessage extension app in which the initial/first view has a button "enter" and when we click "enter" it opens a second view which has one more button "send". I want to send a message using MSMessage when I click "send". My code for when "send" is pressed is:
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "demo.png")!
layout.caption = "I am sending you this image"
let message = MSMessage()
message.layout = layout
activeConversation.insert(message, correctionHandler:nil)
But when I click "send" no action is performed. When I paste the same code inside "enter" button being pressed it works fine. Is there a way I can make this code work even from the second view, i.e. in my case when "send" button is pressed?