I'm having trouble creating an email with MFMailComposerController
in Swift. When I try to assign self
to emailController.mailComposerController
I get an error stating that I can not assign TelaFinalViewController (self)
to a value of type MFMailComposerViewController
.
I wrote the following code below:
// Teste para possibilidade de envio
if MFMailComposeViewController.canSendMail(){
// Criação do Email
let emailController:MFMailComposeViewController = MFMailComposeViewController()
emailController.mailComposeDelegate = self // Ocorre o erro aqui!
emailController.setSubject(assunto)
emailController.setToRecipients([para])
emailController.setMessageBody(corpoEmail, isHTML: false)
// Demais implementação ...
}
Error message:
Can not assign a value of type "ScreenFinalViewController" to a value of type 'MFMailComposeViewControllerDelegate!' '
I looked in tutorials and here in Stackoverflow, but I did not specifically find this a solution or explanation for this problem.
Would it be a bug case?