首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS6:未显示MFMailComposeViewController

iOS6:未显示MFMailComposeViewController
EN

Stack Overflow用户
提问于 2013-06-19 19:24:29
回答 2查看 385关注 0票数 0

MFMailComposeViewController在ios6中不存在,因为在ios6中可以使用相同的代码,而我的代码是

代码语言:javascript
复制
   if ([MFMailComposeViewController canSendMail])
   {
       searchView.hidden=YES;
       MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
       picker.mailComposeDelegate = self;
       [picker setSubject:[NSString stringWithFormat:@"Query from ccc App"]];
       NSArray *toarr =[[NSArray alloc]initWithObjects:@"ccc-connections@ccc.edu", nil];
       [picker setToRecipients:toarr];
       [self presentModalViewController:picker animated:YES];          
   }
EN

回答 2

Stack Overflow用户

发布于 2013-06-19 19:59:20

iOS 6.0中不推荐使用presentModalViewController:animated:

请改用presentViewController:animated:completion:

票数 1
EN

Stack Overflow用户

发布于 2013-06-19 20:06:12

代码语言:javascript
复制
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitel];
[mc setMessageBody:message isHTML:NO];
[mc setToRecipients:empfaenger];

[self presentViewController:mc animated:YES completion:NULL];

}

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

switch (result) {
    case MFMailComposeResultCancelled:
        NSLog(@"Email cancelled");
        break;
    case MFMailComposeResultFailed:
        NSLog(@"Email failed with error: %@", [error localizedDescription]);
        break;
    case MFMailComposeResultSaved:
        NSLog(@"Email saved");
        break;
    case MFMailComposeResultSent:
        NSLog(@"Email sent");
        break;
    default:
        break;
}

[self dismissViewControllerAnimated:YES completion:NULL];

}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17189926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档