2015-08-25 23 views
0
使用发送邮件MFMailComposeViewController我

得到一个错误:无法在iOS的

viewServiceDidTerminateWithError:错误域= _UIViewServiceInterfaceErrorDomain代码= 3 “操作无法完成(_UIViewServiceInterfaceErrorDomain错误3)” 的UserInfo = {0x7c3f4600消息=服务连接中断}

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]; 
} 
+1

可能的重复[我有模拟器中的Swift(iOS8)中的MFMailComposeViewController的真正误解](http://stackoverflow.com/questions/25604552/i-have-real-misunderstanding-with-mfmailcomposeviewcontroller-in-swift- iOS8上式) –

回答

0

您是否在真实设备上测试过?这通常在iPhone模拟器中。