简体   繁体   English

MFMailComposeViewController在iOS 7下无法正常工作

[英]MFMailComposeViewController is not working under iOS 7

[MFMailComposeViewController canSendMail] works well under iOS 6 application, but fail for under iOS7. [MFMailComposeViewController canSendMail]在iOS 6应用程序下运行良好,但在iOS7下无法运行。

iOS 6 mail function: iOS 6邮件功能:

if ([MFMailComposeViewController canSendMail])
{
    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
    mailer.mailComposeDelegate = self;
    [mailer setSubject:@"A Message from Bloomingkids"];
    NSArray *toRecipients = [NSArray arrayWithObjects:@"support@bloomingkids.com", nil];
    [mailer setToRecipients:toRecipients];
    UIImage *myImage = [UIImage imageNamed:@"bloomingKidsLogo.png"];
    NSData *imageData = UIImagePNGRepresentation(myImage);
    [mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"Images"];
    NSString *emailBody = @"Have you seen the Bloomingkids web site?";
    [mailer setMessageBody:emailBody isHTML:NO];
    [self presentViewController:mailer animated:YES completion:nil];
}
else
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure"
                                                    message:@"Your device doesn't support the composer sheet"
                                                   delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles: nil];
    [alert show];
}

Note: It's working on simulator but not on iPad. 注意:它可以在模拟器上运行,但不能在iPad上运行。 The error was Your device doesn't support composer sheet 错误是您的设备不支持作曲家表格

在您的设备中添加任何电子邮件帐户意味着要设置一个电子邮件帐户...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM