if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController * mailComposeController=[[MFMailComposeViewController alloc]init];
mailComposeController.mailComposeDelegate = self;
// mailComposeController.wantsFullScreenLayout = NO;
[mailComposeController setSubject:@"WallPaperApp."];
[mailComposeController setMessageBody:@"This is my new Wallpaper." isHTML:NO];
UIImage *img=mainImageView.image;
UIImage *img1=[UIImage imageNamed:@"aaa.jpg"];
NSData *imageData = UIImagePNGRepresentation(img);
[mailComposeController addAttachmentData:imageData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"photo.png"]];
[self presentModalViewController:mailComposeController animated:YES];
//[mailComposeController release];
}
its working fine in ios5 but not working in ios6 m testing on device
I fixed the exact same problem this way:
I did import:
But I forgot this:
After adding the import of MessageUI.h, no more problems on iOS 6.
Try below code in didfinishloading in appdelegate
rootController is a uiviewcontroller instance