gpt4 book ai didi

ios - 短信功能在设备上返回错误

转载 作者:行者123 更新时间:2023-11-30 12:32:41 26 4
gpt4 key购买 nike

我正在从 Firebase 数据库中检索电话号码,无论我如何将其输入数据库,它都会在我的设备上返回错误:

"Message sent to invalid destination. Please check your number and try again. Msg 2127"

消息发送后立即自动回复。我尝试将其输入 firebase 作为 111-111-11111111111111 (实际上不是使用数字 1,而是真实的电话号码)。

调用功能工作正常,但发送短信的同一号码不起作用。

var contact: Int!
@IBAction func textButton(_ sender: Any) {
if canSendText() {
if let contactopt = contact{
var messageVC = MFMessageComposeViewController()
messageVC.recipients = ["tel:\(contactopt)"]
messageVC.messageComposeDelegate = self;

self.present(messageVC, animated: false, completion: nil)}}
else {
let errorAlert = UIAlertView(title: "Cannot Send Text Message", message: "Your device is not able to send text messages.", delegate: self, cancelButtonTitle: "OK")
errorAlert.show()
}

}


func canSendText() -> Bool {
return MFMessageComposeViewController.canSendText()
}

func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {

controller.dismiss(animated: true, completion: nil)
}


@IBAction func callButton(_ sender: UIButton) {

if let contactopt = contact{

if let url = NSURL(string: "tel://\(contactopt)") {
// UIApplication.shared.openURL(url as URL)
UIApplication.shared.open(url as URL, options: [:], completionHandler: nil)

}
}
}

最佳答案

我必须改变 messageVC.recipients = ["电话:(contactopt)"]

messageVC.recipients = [String(contactopt)]

关于ios - 短信功能在设备上返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43301421/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com