2015-08-25 55 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模擬器中。