Send URL with iMessage App

让人想犯罪 __ 提交于 2019-12-24 01:58:33

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/39392420/send-url-with-imessage-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!