【发布时间】:2012-10-04 06:25:47
【问题描述】:
我正在使用 MFMailcomposer 从我在 iPhone 中的应用程序发送邮件。一切正常,但是当我将它移植到 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];
}
`
【问题讨论】:
-
当打开控制器发送邮件后出现那个错误?
-
显示一些展示 MFMailcomposer 视图的代码..
-
@neonsamuel 它在瞬间打开控制器,但没有做任何事情就关闭了
-
@bugfinder 请在设备中运行应用程序并检查一下
-
它也发生在我身上......我猜这是iOS6的问题。我的(快速...)解决方案是打开 mail.app 而不是这个。