Send URL with iMessage App
Asked Answered
D

1

2

I would like to send a link with my message to allow the user to open the app store to install the app or use a deep link to link into a certain piece of content in my app, similar to the Apple Music iMessage App. I am currently using:

var messagee:MSMessage = message.url = URL(string: "https://itunes.apple.com/us/app/reaction-timer-game/id572319874?ls=1&mt=8")
template.image = game1Image.image!
template.imageTitle = "Game 1"
template.imageSubtitle = "\(bestScore1[0])"

But when I tap on the the image the iMessage app opens instead of the URL. Is this possible and if so, how can I do this?

Should I be sending the URL with this:

let url = URL(string: "urlData")
    self.activeConversation?.insertAttachment(url!, withAlternateFilename: "URL", completionHandler: { (error) in
        if error != nil {
            print("Error")
        } else {
            print("Sent")
        }
    })

Thank you

Developing answered 8/9, 2016 at 13:34 Comment(2)
I found this post helpful: hackingwithswift.com/ios10Developing
You will using iMessage to increase app download (y) :) .Ifni
A
2

I don't think that's possible. If you try to open any URL or a URL scheme, it will open your main iOS app if you have one. In my case I wanted to display a web page so what I did is just use a UIWebView instead of opening Safari directly.

iMessage will already display your app link if the recipient doesn't have it installed. This helps app discoverability but you can't automatically open your app in the App Store.

Algiers answered 8/9, 2016 at 14:14 Comment(5)
Did you add the UIWebView inside the iMessage app?Developing
Yes, I did. Added as subview of my extension View Controller and it works perfectly.Algiers
Okay I will try that. How are you sending the data with the message for your iMessage app to open it in the webView? ThanksDeveloping
I'm just passing it a URL and displaying the webpage with UIWebView APIs.Algiers
Should I be sending the URL with the code I added above?Developing

© 2022 - 2024 — McMap. All rights reserved.