I have a view controller which opens an MFMailComposeViewController modally. When I try to set the mail view controller's delegate to the parent view controller, I get this warning:
Assigning to 'id<UINavigationControllerDelegate>' from incompatible
type 'MoreViewController *__strong'
The parent view controller definitely has MFMailComposeViewControllerDelegate in its interface declaration and is implementing the delegate method -mailComposeController: didFinishWithResult:error:
as follows:
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
NSLog(@"Delegate called");
}
I really don't understand why the parent view controller is being recognized as a UINavigationControllerDelegate, as I don't implement those methods nor do I declare it as such. I wouldn't be so worried about it but the delegate method never gets called, so I'm guessing this "mismatch" is part of the problem.
If it helps, this is how I am initting the mail view controller, in viewDidLoad
:
// MAIL
self.mail = [[MFMailComposeViewController alloc] init];
self.mail.delegate = self;
Thanks in advance for any thoughts you may have.