繁体   English   中英

_UIViewServiceInterfaceErrorDomain

[英]_UIViewServiceInterfaceErrorDomain

我遇到了MFMailComposeViewController的问题

我收到了这个错误

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=... {Message=Service Connection Interrupted}

用这个代码

- (IBAction) mailbutton:(id)sender 
{

    if([MFMailComposeViewController canSendMail]) 
    {

        [MSAPP.globalMailComposer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
        [self presentViewController:MSAPP.globalMailComposer animated:YES completion:nil];

    } 
    else 
    {

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                    message:@"Unable to mail. No email on this device?"
                                                   delegate:self
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
        [alert show];
        [MSAPP cycleTheGlobalMailComposer];
    }
}

这是iOS 8模拟器的已知问题。 请参阅此帖子以获取可能的解决方法。

您必须在早期阶段分配和启动MFMailComposeViewController,并在需要时将其保存在一个静态变量中,获取静态MFMailComposeViewController实例并显示它。

并且你几乎肯定必须在每次使用后“循环”全局MFMailComposeViewController。 “重复使用”同一个是不可靠的。 有一个全局例程,它释放然后重新初始化单例MFMailComposeViewController。 完成后每次调用它

这篇文章归功于“Joe Blow” 根据您的代码判断,您已经声明了全局邮件编写器。 尝试“回收”它,如帖子建议,看看是否能解决您的问题。 我有同样的问题,不幸的是这个解决方案并没有解决我的问题。 我可以确认这个解决方案适用于iOS 7.1模拟器但不适用于iOS 8,尽管有人建议它可以在物理iOS 8设备上运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM