Hi i am getting confuse on MFMailComposeViewController delegate property, when i set mailer.mailComposeDelegate app crash just after call [self presentModalViewController:mailer animated:YES]; and when i do mailer.delegate then app don’t crash but its view can’t hide after sending mail or just cancel it from its navigation bat button “Cancel”. I am getting stuck why this happen.
Let me share code, you get hint where i am doing mistake.
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
if(mailer)
{
mailer.mailComposeDelegate = self;
//mailer.delegate=self;
[mailer setSubject:@"What the Buck?"];
imageData = UIImagePNGRepresentation(screenImgSubCat);
[mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"testapp"];
NSString *emailBody = @"What the Buck?! – www.testapp.com";
[mailer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailer animated:YES];
//[mailer release];
}
}
}
Updated
I change code and use mailer.mailComposeDelegate = self; and also comment this line [mailer release]; still giving me crash on when image is being loading.
Here is the Image what i am getting after crash.

In .h file are you adding
MFMailComposeViewControllerDelegateDisplay ComposerSheet
and delegate method
EDIT
picker.mailComposeDelegateits delegate ofMFMailComposeViewControllerDelegateIts respond to
- (void)mailComposeControllerpicker.delegateits delegate ofUINavigationControllerDelegateIts respond to navigation controller not
- (void)mailComposeController, so on cancel click it will not call, thats why yourMFMailComposeViewControllerview is not hiding.