我在使用 MFMailComposeViewController 时遇到问题。
当我点击一个按钮时,MFMailComposeViewController 的一个实例应该会出现:
http://postimg.org/image/i24gn4oi7/
但是当它发生时,会发生这种情况:
http://postimg.org/image/kdwm0isrl/
这是代码:
- (IBAction)actionEmailComposer {
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
NSMutableArray *email = [[NSMutableArray alloc] initWithObjects:@"factto@gmail.com", nil];
[mc setToRecipients:email];
//[mc setSubject:@"SUBJECT_HERE"];
[mc setMessageBody:@"Referência: \nCor:" isHTML:NO];
mc.modalPresentationStyle = UIModalPresentationFullScreen;
// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
{
NSLog(@"Mail sent");
UIAlertView *msg = [[UIAlertView alloc] initWithTitle:@"Obrigado!" message:@"Logo logo entraremos em contato!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[msg show];
}
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
实际上,在 iPad 上它确实可以正常工作,它只是在 iPhone 上发生!到底是怎么回事?我究竟做错了什么?
提前致谢。