Swift Sharp Swift Sharp - 1 year ago 83
Objective-C Question

Sending an email causes - Connection interrupted

Basically what am i trying to do is to send an email:

-(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:@[@"testing@gmail.com"]];

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

There is no error, no warning. The output if this void is:

BSXPCMessage received error for message: Connection interrupted

How can I solve this?

test device - 5S(8.3)

Answer Source
  1. From this Apple Guide I can understand that XPC services are supposed to prevent apps from crashing by separating unstable components somehow.

  2. The crash itself is caused by some kind of a bug in CIFilter. It's hard to tell what actually is wrong with your code, since the issue is obviously not with MFMailComposeViewController. If you are creating CIContext with options like this:

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

Try to replace NO with YES

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download