MFmailcomposer有时会发生错误?

我正在使用MFMailcomposer从我的应用程序在iPhone中发送邮件。它都工作正常,但是当我将它移植到iPhone 5和ios6某个时候

_serviceViewControllerReady:error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=1 "The operation couldn't be completed. (_UIViewServiceInterfaceErrorDomain error 1.但如果我再次运行没有问题,它工作正常。

我正在像这样介绍邮件composer php

 action { Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); if (mailClass != nil) { // We must always check whether the current device is configured for sending emails if ([mailClass canSendMail]) { [self displayComposerSheet]; } else { [self launchMailAppOnDevice]; } } else { [self launchMailAppOnDevice]; } } void)displayComposerSheet { AppDelegate *appdelegate=[[UIApplication sharedApplication] delegate]; MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@"report"]; // Set up recipients NSArray *toRecipients=[NSArray arrayWithObject:@""]; NSArray *ccRecipients =[[NSArray alloc]init];//= [NSArray arrayWithObjects:@"", @"", nil]; NSArray *bccRecipients=[[NSArray alloc]init];// = [NSArray arrayWithObject:@""]; [picker setToRecipients:toRecipients]; [picker setCcRecipients:ccRecipients]; [picker setBccRecipients:bccRecipients]; [picker setMessageBody:@"Please send me now." isHTML:YES]; [appdelegate.navigationController presentModalViewController:picker animated:YES]; [appdelegate.navigationController.navigationBar setHidden:NO]; [picker release]; } 

`

我有同样的问题,这似乎是一个与特定的UIAppearance自定义相关的错误。 当我删除我的自定义UISearchBar背景图像完全消失。

您应该使用:在iOS 6中不推荐使用presentModalViewController

 [appdelegate.navigationController presentViewController:picker animated:YES completion:nil]; 

代替

 [appdelegate.navigationController presentModalViewController:picker animated:YES]; 

我也面临同样的问题,但最终解决了这个问题。

closuresXcode并重新启动系统,它将工作。

尝试这个,

  [self presentModalViewController:picker animated:YES];