【问题标题】:Sending sms with swift language in ios8在 ios8 中使用 swift 语言发送短信
【发布时间】:2014-10-27 22:47:39
【问题描述】:

我正在尝试使用 MFMessagingComposeViewController 发送短信

这是swift中的代码:

导入 MessageUI 后

let msg:MFMessageComposeViewController=MFMessageComposeViewController()
msg.recipients=["7236446823423"]
msg.body="txt"
self.presentViewController(msg,animated:true,completion:nil)

我得到一个错误:

libc++abi.dylib 以 NSException 类型的未捕获异常终止

【问题讨论】:

  • 你的项目中是否包含了框架文件?

标签: ios iphone swift sms


【解决方案1】:

检查 MFMessageComposeViewController 是否可以发送文本canSendText:

if MFMessageComposeViewController.canSendText(){
            let msg:MFMessageComposeViewController=MFMessageComposeViewController()
            msg.recipients=["7236446823423"]
            msg.body="txt"
            self.presentViewController(msg,animated:true,completion:nil)
        }
        else {
            NSLog("your device do not support SMS....")
        }

【讨论】:

    猜你喜欢
    • 2014-12-08
    • 2010-10-24
    • 2022-06-28
    • 2016-09-12
    • 1970-01-01
    • 2017-01-06
    • 2013-01-22
    • 2020-05-01
    • 1970-01-01
    相关资源
    最近更新 更多