Как поделиться URL-адресом и текстом в приложении Masseage, используя swift 3
Я должен поделиться текстом и URL к приложению сообщений.
if (MFMessageComposeViewController.canSendText()) {
let controller = MFMessageComposeViewController()
//controller.subject = "http://www.appzoy.com"
//controller.attachments?.append(["url" : URL(string : "http://www.appzoy.com")!])
//controller.addAttachmentURL(URL(string : "http://www.appzoy.com")!, withAlternateFilename: "")
controller.body = "Hey I just gave an Awesome Assessment on UAssess App you can also try it. I scored \(String(describing: myScore!)) , Try to beat my score"
controller.messageComposeDelegate = self
self.present(controller, animated: true, completion: nil)
}
else {
Helper.sharedInstance.Print("No Message Composer Present" as AnyObject)
}.
Я пытаюсь передать URL-адрес, но он не собирается отправлять сообщения. Кто-нибудь знает, как поделиться URL-ссылкой и текстом в приложении для сообщений.
1 ответ
Попробуйте код ниже:
let controller = MFMessageComposeViewController()
if (MFMessageComposeViewController.canSendText()) {
let urlToShare = "http://www.appzoy.com"
controller.body = "Hey I just gave an Awesome Assessment on UAssess App you can also try it. I scored , Try to beat my score \(urlToShare)"
controller.messageComposeDelegate = self
self.present(controller, animated: true, completion: nil)
}