简体   繁体   English

无法在iOS中使用MFMailComposeViewController发送邮件

[英]Unable to send mail using MFMailComposeViewController in iOS

I got an error : 我有一个错误:

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn't be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7c3f4600 {Message=Service Connection Interrupted} viewServiceDidTerminateWithError:错误域= _UIViewServiceInterfaceErrorDomain代码= 3“操作无法完成。(_ UIViewServiceInterfaceErrorDomain错误3。)” UserInfo = 0x7c3f4600 {Message =服务连接中断}

 if([MFMailComposeViewController canSendMail])
    {

        MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
        mail.mailComposeDelegate = self;
        [mail setSubject:@"Contact"];
        [mail setMessageBody:@"Here is some main text in the email!" isHTML:NO];
        [mail setToRecipients:@[self.salonemail.text]];

        [self presentViewController:mail animated:YES completion:NULL];
    }
    else{
        [self showAlert:@"Looks like your device can't send emails"];
        }

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{

    [self dismissViewControllerAnimated:YES completion:NULL];
}

Have you tested on real devices? 您是否在真实设备上进行过测试? This usually comes in iPhone simulators. 通常在iPhone模拟器中提供。

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

相关问题 无法在模拟器中使用MFMailComposeViewController发送电子邮件 - Unable to send email using MFMailComposeViewController in simulator iOS MFMailComposeViewController已发送邮件但未收到 - iOS MFMailComposeViewController sent mail but not received 如何在iOS MFMailComposeViewController中预先选择邮件帐户? - How to preselect the mail account in iOS MFMailComposeViewController? MFMailComposeViewController canSendMail返回YES但不在iOS中发送邮件 - MFMailComposeViewController canSendMail returns YES but not sending mail in iOS SwiftUI:使用 MFMailComposeViewController 发送 email - SwiftUI: Send email using MFMailComposeViewController MFMailComposeViewController iOS 上缺少取消和发送按钮 - Cancel and send button missing on MFMailComposeViewController iOS 使用MFMailComposeViewController,是否可以BCC默认邮件帐户? - Using MFMailComposeViewController, is it possible to BCC the default mail account? 如何从iPhone应用程序发送邮件而不显示MFMailComposeViewController? - How to send mail from iphone app without showing MFMailComposeViewController? 邮件界面取消按钮不起作用的ios-MFMailComposeViewController类 - mail interface cancel button not working ios - MFMailComposeViewController class 无法使用MFMailComposeViewController在应用程序中发送电子邮件 - Cannot send email in app using MFMailComposeViewController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM