How to embed a URL on a MSMessage?

399 views Asked by At

Currently able to attach an image to the MSMessage. Also setting the url of MSMessage using MSMessage.url as below.

However when the recipient taps on the message, the URL does not open in Safari browser. Instead the App store opens up.

// Appearance of message
let layout = MSMessageTemplateLayout()
layout.caption = "Welcome to this URL"
layout.image = UIImage(named: "sample.png")

let message = MSMessage()
message.layout = layout

let urlString = "https://herokuapp.com/#abd625fc1af2"
message.url = URL(string: urlString)

activeConversation?.insert(message, completionHandler: nil)
1

There are 1 answers

0
olejnjak On

When I needed to share an URL, I just inserted the urlString iMessage than recognizes it is an URL and it works just fine.

That would be the same as here - ios 11 imessage extension message.url does not open safari