0

MFMailComposeViewController 没有出现在 ios6 中,因为相同的代码在 ios6 中工作,我的代码是

   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];          
   }
4

2 回答 2

1
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];

}

于 2013-06-19T12:06:12.423 回答
1

presentModalViewController:animated:在 iOS 6.0 中已弃用。

改为使用presentViewController:animated:completion:

于 2013-06-19T11:59:20.473 回答