我想从我的应用程序中打开imessage,并在文本字段中填充“共享我的应用程序...”(底部的消息字段,而不是电话号码字段)
我可以使用下面这行代码从我的应用程序中打开消息:
UIApplication.shared.open(URL(string: "sms:")!, options: [:], completionHandler: nil)但我不知道如何通过它传递消息。有没有可能不使用MFMessageComposeViewController()来做这件事?我不能使用这个背景播放问题的原因,我正在经历,谢谢你。
发布于 2018-04-25 13:39:15
与@Kuldeep的回复非常相似
let sms: String = "sms:+1234567890&body=Hello Abc How are You I am ios developer."
let strURL: String = sms.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
UIApplication.shared.open(URL.init(string: strURL)!, options: [:], completionHandler: nil)似乎为我做到了这一点,感谢Kuldeep对我的帮助;)
发布于 2018-04-25 13:04:53
尝尝这个。
let sms: String = "sms:+1234567890&body=Hello Abc How are You I am ios developer."
UIApplication.shared.open(URL.init(string: sms.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)!, options: [:], completionHandler: nil)发布于 2018-04-25 13:13:19
尝试以下步骤在iMessage上发送文本
如果MFMessageComposeViewController.canSendText() { let controller = MFMessageComposeViewController() controller.body = "Your Text here“controller.messageComposeDelegate = self controller.recipients = [] self.present(控制器,动画:真,完成:空)}
MFMessageComposeViewControllerDelegate的以下方法函数控制器(_messageComposeViewController: MFMessageComposeViewController,didFinishWith结果: MessageComposeResult) {controller.dismiss(动画:真,完成:无) }
https://stackoverflow.com/questions/50014004
复制相似问题