在我的 iPhone 应用程序中。我正在使用MFMailComposeViewController
. 现在,当我第二次进入邮件表时,我的应用程序崩溃了。我在谷歌搜索。但我找不到解决方案。任何人都可以帮助我解决我的问题。请查看下面的代码并帮助我我在哪里做错了。
if ([MFMailComposeViewController canSendMail])
{
controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@""];
[controller setToRecipients:array1];
[controller setMessageBody:@"" isHTML:NO];
[controller setMailComposeDelegate: self];
[controller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.navigationController presentModalViewController:controller animated:NO];
[controller release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
if(result == MFMailComposeResultSent)
{
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
else if (result == MFMailComposeResultCancelled)
{
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
}