Reputation: 211
[MFMailComposeViewController canSendMail]
works well under iOS 6 application, but fail for under iOS7.
iOS 6 mail function:
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"A Message from Bloomingkids"];
NSArray *toRecipients = [NSArray arrayWithObjects:@"[email protected]", 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. The error was Your device doesn't support composer sheet
Upvotes: 0
Views: 2973