简体   繁体   中英

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

So far I've been encountering scenarios where you can launch the embedding app from the extension using the openURL: method, but is there a way to achieve the opposite?

I'm interested in knowing whether it would be possible to do something in my container app that creates an MSMessage instance and launches my iMessage app extension. Is this doable?

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)

Unfortunately, this is not currently possible. You can read it in this thread: https://forums.developer.apple.com/thread/50375

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM