0
I’m having trouble creating an email with MFMailComposerController
on Swift. When trying to assign self
to emailController.mailComposerController
I get an error stating that I cannot assign TelaFinalViewController (self)
for 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:
Cannot assign a value of type "Telafinalviewcontroller" to a value of type 'Mfmailcomposeviewcontrollerdelegate!'
I searched in tutorials and right here in Stackoverflow, but did not find this specifically a solution or explanation for this problem.
It would be a case of bug?
Perfect, I just changed the syntax. Thank you!
– Tiago Amaral