这是一个Swift 2.0项目。我有一个MFMailComposeViewController按预期显示,但没有填充内容,并且不响应用户交互,但取消按钮除外。
发送按钮显示为灰色。没有文本字段响应用户触摸。
在iPhone 6+ iOS 8.4.1,Xcode 7.0b6上运行
我错过了什么?
以下是我使用的代码:
@IBAction func hitSendEmail(sender: AnyObject) {
let emailTitle = "Title goes here"
let emailBody = "Blah blah blah blah."
let recipientAddress = "EMAILGOESHERE"
mailViewController = MFMailComposeViewController()
guard let mailvc = mailViewController else {
return
}
mailvc.mailComposeDelegate = self
mailvc.setSubject(emailTitle)
mailvc.setMessageBody(emailBody, isHTML: false)
mailvc.setToRecipients([recipientAddress])
self.presentViewController(mailvc, animated: true) { () -> Void in
}
}
func mailComposeController(controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error: NSError?) {
if let vc = controller.presentingViewController {
vc.dismissViewControllerAnimated(true, completion: { () -> Void in
self.mailViewController = nil
})
}
}
答案 0 :(得分:0)
SOLVED: Apparently it's a bug in Xcode 7.0b6.
I recompiled the app under Xcode 6.4 (after changing the 'guard' statement to an 'if let') and it runs without problem.