iphone - MFmailcomposer 有时会出错?

标签 iphone ios ipad

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

`

最佳答案

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

关于iphone - MFmailcomposer 有时会出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12721462/

相关文章:

ios - 适用于 iOS 的蜘蛛(雷达)图表

iphone - 如何提供像新 Facebook iPhone 应用程序一样的导航 View

ios - NSNotificationCenter 多次调用

IOS——如何在 UITableViewCell 中移动 UILabel?

android - 平板电脑(iPad/Android)-服务器通讯协议(protocol)

objective-c - 为什么我的 for 循环泄漏?

javascript - iPad、JavaScript 字符代码和 shiftKey

iphone - 使网站设计适合移动设备的工具

ios - objective-c :如何在iOS中查看代码

android - 如何使用基本身份验证保护 Android/iOS 应用程序的 Web API