嗨,我想用网址打开带乳头的短信应用程序,我编写以下代码,但我面临
像这样的错误:静态成员'canSendText'不能用于'MFMessageComposeViewController'类型的实例
var controller1 = MFMessageComposeViewController()
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.section == 0
{
if (controller1.canSendText()) {
let urlToShare = "http://www.appzoy.com"
controller1.body = "Hey I just gave an Awesome Assessment on UAssess App you can also try it. I scored , Try to beat my score \(urlToShare)"
controller1.messageComposeDelegate = self as? MFMessageComposeViewControllerDelegate
self.present(controller1, animated: true, completion: nil)
}
}
}
最佳答案
如doc中所述,您应该使用:
if MFMessageComposeViewController.canSendText() {
print("SMS services are available")
}
关于swift - 使用MFMessageComposeViewController快速打开带有文本和URL的短信应用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54939304/