MFMailComposer无法在io6横向模式下工作

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

它在ios5中工作正常,但不能在ios6 m设备上进行测试

在appdelegate中的didfinishloading中尝试以下代码

 rootController = [[firstViewController alloc] initWithNibName:@"firstViewController" bundle:nil]; navigationController = [[UINavigationController alloc]initWithRootViewController:rootController]; window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [window addSubview:navigationController.view]; [window makeKeyAndVisible]; 

rootController是一个uiviewcontroller实例

我用这种方式解决了完全相同的问题:

我做了导入:

 #import  

但我忘了这个:

 #import  

添加了MessageUI.h的导入后,iOS 6上没有更多问题。