iPhone在调用eMail发送后没有返回应用程序

时间:2010-06-05 23:19:18

标签: iphone objective-c

我正在从我的iPhone应用程序中发送电子邮件。电子邮件页面弹出正常,我点击发送按钮,iPhone播放嗖嗖声,电子邮件实际上到达收件人。

不幸的是,邮件对话框仍然没有响应,唯一的选择 - 点击主页按钮 - 会杀死应用程序。

是否需要指定其他内容才能关闭eMailMessage视图?

MFMailComposeViewController *eMailMessage;
NSArray *toAddress;

if ([MFMailComposeViewController canSendMail]) {
    toAddress = [NSArray arrayWithObject:@"bill@somewhere.com"];
    eMailMessage = [[MFMailComposeViewController alloc] init];
    [eMailMessage setToRecipients:toAddress];
    [eMailMessage setSubject:@"Notification"];
    [eMailMessage setMessageBody:@"Performed by ..." isHTML:NO];
    [self presentModalViewController:eMailMessage animated:YES];
    [eMailMessage release];
}

1 个答案:

答案 0 :(得分:1)

您需要设置委托并实现此方法:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {

    [controller dismissModalViewControllerAnimated:YES];
}