我有联系人表,逻辑用户将多选联系人发送短信邀请到应用程序,我的问题是在弹出短信撰写(关闭或发送)后,作曲家关闭并且应用程序已重启,是它的工作原理如何?为什么它应该重置应用程序我只是关闭或取消短信撰写控制器!
这就是我做的事情
//Send SMS
func sendSMS( to : [String] = [] , message : String = "" )
{
if (MFMessageComposeViewController.canSendText())
{
let controller = MFMessageComposeViewController()
controller.body = message
controller.recipients = to
if let topController = UIApplication.topViewController()
{
controller.messageComposeDelegate = topController as MFMessageComposeViewControllerDelegate
topController.present(controller, animated: true, completion: nil)
}
}
}
extension UIViewController: MFMessageComposeViewControllerDelegate {
public func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
switch (result.rawValue) {
case MessageComposeResult.cancelled.rawValue:
print("Message was cancelled")
controller.dismiss(animated: true, completion: nil)
case MessageComposeResult.failed.rawValue:
print("Message failed")
controller.dismiss(animated: true, completion: nil)
case MessageComposeResult.sent.rawValue:
print("Message was sent")
controller.dismiss(animated: true, completion: nil)
default:
break;
}
}
}
无论如何关闭短信作曲家而不重新加载应用程序?