Вла*_*кий 10 swift ios10 mfmailcomposeviewcontroller
我执行发送消息的标准功能MFMailComposeViewController.
我的代码:
if MFMailComposeViewController.canSendMail()
{
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(["someemail@gmail.com"])
mail.setSubject("Subject")
mail.setMessageBody("Some Text", isHTML: false)
self.presentViewController(mail, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
控制器无法打开,我在控制台中看到一条从未见过的消息.
[MC]过滤捆绑包ID的邮件表帐户:[我的捆绑ID],源帐户管理:1
[MC]结果:没有
请帮忙.
适用于Swift 3.0.1 - 4.2 兼容
if MFMailComposeViewController.canSendMail()
{
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(["someemail@gmail.com"])
mail.setSubject("Subject")
mail.setMessageBody("Some Text", isHTML: false)
self.present(mail, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的错误,尽管它在我的iOS 10.1.1设备上完美运行。我遇到了类似的问题,发现邮件编辑器只能在模拟器中的 iOS 9 上运行,根据我目前的知识,iOS 10 和在模拟器上运行邮件编辑器存在某种错误。
更新 我还使用 iOS 11.4 的设备对此进行了测试,并得到了相同的结果。
尝试使用这些调用在模拟器上打开邮件,但它们不起作用。虽然工作正常,但它们在真实设备上运行良好。
UIApplication.shared.keyWindow?.rootViewController?.present(mail, animated: true)
self.navigationController?.present(mail, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10981 次 |
| 最近记录: |