MFMailComposeViewController在呈现后立即解除

时间:2014-08-09 14:00:42

标签: ios objective-c email uiviewcontroller

它适用于iPhone,此问题仅发生在iPad(iOS7)上。太奇怪了。

我收到了这个错误日志:

  

_serviceViewControllerReady:error:Error Domain = _UIViewServiceInterfaceErrorDomain Code = 0“无法完成操作。(_UIViewServiceInterfaceErrorDomain error 0。)”

我做了一些搜索,一些答案说它可能与定制的UINavigationBar外观有关。

就我而言,我正在使用导航控制器并更改其颜色和状态栏颜色

在info.plist中:set View controller-based status bar appearanceNO

然后在appDelegate

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 

我尝试评论该行,问题仍然存在。所以我认为这不是问题所在。

这是我的发送电子邮件代码和代理

Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil) {
    if ([mailClass canSendMail]) {
        MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
        mailPicker.mailComposeDelegate = self;
        NSString *emailbody = @"";
        [mailPicker setSubject: subject];
        NSArray *toRecipients = [NSArray arrayWithObject: recipient];
        [mailPicker setToRecipients: toRecipients];
        [mailPicker setMessageBody:emailbody isHTML:NO];
        [self presentViewController:mailPicker animated:YES completion:nil];
    } 
} 

- (void)mailComposeController:(MFMailComposeViewController *)controller
      didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
    [self dismissViewControllerAnimated:YES completion:nil];
}

0 个答案:

没有答案
相关问题