Ich versuche MFMailComposeViewController() in zwei Zellen zu implementieren (Betreff "Feedback" und "Feedback2").MFMailComposeViewController nicht aufgerufen
Wenn ich jede Zelle auswählen, funktioniert "Feedback" gut, aber "Feedback2" wird nicht aufgerufen.
Es scheint kein Problem, aber ich finde es schwierig, das Problem zu beheben.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.row == 0 {
let message = "hey download this app"
let shareView = UIActivityViewController(activityItems: [message], applicationActivities: nil)
self.present(shareView, animated: true, completion: nil)
} else if indexPath.row == 1 {
let mailCompose = MFMailComposeViewController()
mailCompose.mailComposeDelegate = self
mailCompose.setToRecipients(["gmail.com"])
mailCompose.setSubject("feedback")
mailCompose.setMessageBody("text", isHTML: false)
if MFMailComposeViewController.canSendMail()
{
self.present(mailCompose, animated: true, completion: nil)
} else if indexPath.row == 2 {
let mailCompose = MFMailComposeViewController()
mailCompose.mailComposeDelegate = self
mailCompose.setToRecipients(["[email protected]"])
mailCompose.setSubject("feedback2")
mailCompose.setMessageBody("text", isHTML: false)
if MFMailComposeViewController.canSendMail()
{
self.present(mailCompose, animated: true, completion: nil)
}
else{
print("error...!")
}
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true, completion: nil)
}
@ risa18 Fehler Ich denke, man indexPath.row == rufen 2 Inside indexPath.row == 1. –