IPhone のアプリケーションからメールを送信するために MFMailcomposer を使用しています。すべて正常に動作していますが、いつか iPhone 5 と ios6 に移植すると
_serviceViewControllerReady:error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=1 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 1.
しかし、もう一度実行しても問題はなく、正常に動作していました。
このようにメール作成者を提示しています `
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];
}
`