选择表视图的单元格时显示邮件编辑器

时间:2012-09-20 22:31:48

标签: iphone xcode uitableview mfmailcomposeviewcontroller

我正在尝试让我的表视图在选择单元格时显示mailcomposerviewcontroller。我尝试过使用:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;



// Set up recipients
if ([arryData objectAtIndex:0]) {
    [picker setSubject:@"To You"];

    NSArray *toRecipients = [NSArray arrayWithObject:@"emailaddress@here.com"];
    [picker setToRecipients:toRecipients];

    // Fill out the email body text
    NSString *emailBody = @"From Me";
    [picker setMessageBody:emailBody isHTML:NO];

    [self presentModalViewController:picker animated:YES];
    [picker release];
}
}

然而,这让我崩溃了,

which is waiting for a delayed presention of <MFMailComposeViewController:

2 个答案:

答案 0 :(得分:0)

如果设备配置为发送邮件,最好先检查您可以看到 link

答案 1 :(得分:0)

您的代码段在这里似乎没问题。 如果你遗漏了一些事情,仍然会再次执行这些步骤。

http://www.roseindia.net/answers/viewqa/Mobile-Applications/18176-iPhone-MFMailcomposeviewcontroller-example.html

我希望它可以帮到你! 干杯!!