How to Send Msmessage in Messages Extension

iOS messages extension how to switch host app directly

i think i found the answer.

there is no way with using

conversation.insert(message, completionHandler)

i think apple music and google maps are using

conversation.insertText("some url", completionHandler)

because i copied an URL after long press a message which is shared by apple music or google map

then i use the URL in my code

conversation.insertText("the URL", completionHandler)

it's working they did!!

iOS 10 messages extension - implementing didRecieve() and selectedMessage in Simulator

Once the receiver selects the message, willBecomeActive is called and gives you the MSConversation, which holds the selectedMessage:

override func willBecomeActive(with conversation: MSConversation) {
super.willBecomeActive(with: conversation)
let message = conversation.selectedMessage
...
}

See: Helpful Apple sample

Is it possible to create a custom MSMessageLayout for iMessage app extension? If so, can some one provide me an example

Usually when you send a MSMessage inside a MSMessageTemplateLayout, the app icon is shown on the top-left corner (in your screenshot, it doesn't appear) so this makes me think that they probably use insertAttachment(_:). In this way the media is handled automatically by iMessage as it has been sent via sharing from any other apps.

Is there are way to open an iMessage extension from within the container app?

If anyone else is interested, as of Xcode 8.0 beta 6, MFMessageComposeViewController declares a property message of type MSMessage that lets you create an interactive message from within a springboard application so it can be used to achieve what I wanted in the first place. It does not, however, let you open a container app application.

Here's my code:

let message = MSMessage()
message.url = // Your message url
message.layout = MSMessageTemplateLayout()
message.summaryText = // Summary text

let messageViewControler = MFMessageComposeViewController()
messageViewControler.message = message

show(messageViewControler, sender: self)


Related Topics



Leave a reply



Submit