2016-10-18 33 views
2

我豈基本上做的是發送電子郵件:發送電子郵件原因 - 連接中斷

-(void) sendAnEmail { 

    if ([MFMailComposeViewController canSendMail]) 
    { 
     MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init]; 
     mail.mailComposeDelegate = self; 
     [mail setSubject:@"Subject"]; 
     [mail setMessageBody:@"Hey, check this out!" isHTML:NO]; 
     [mail setToRecipients:@[@"[email protected]"]]; 

     [self presentViewController:mail animated:YES completion:NULL]; 
    } 
    else 
    { 
     NSLog(@"device cannot send email"); 
    } 
} 

沒有錯誤,沒有任何警告。輸出。如果這個空間是:

BSXPCMessage的消息中收到錯誤:連接中斷

我該如何解決這個問題?

試驗裝置 - 5S(8.3)

+0

是這段代碼實際上越來越叫什麼名字? – alexburtnik

+0

你對CIFilter有任何操縱嗎? – alexburtnik

+0

好吧,我想發送附件的電子郵件,出現同樣的問題,所以我嘗試一些簡單的事情,這是實際的代碼 –

回答

1
  1. this Apple Guide我可以理解,XPC服務都應該避免通過某種方式分離不穩定成分崩潰的應用程序。

  2. 崩潰本身是由CIFilter中某種錯誤引起的。 很難說您的代碼實際上有什麼問題,因爲該問題顯然不適用於MFMailComposeViewController。如果您正在使用像這樣的選項創建CIContext

[CIContext contextWithOptions: @{kCIContextUseSoftwareRenderer : @(NO)}]; 

嘗試更換NOYES