IOS 8 Email Configuration

I am trying to open up email in iOS 8 from Xcode 6, but I get an error message. The same code works fine if I try to use Xcode 5. Later I downloaded a sample code from the Apple Developer Portal:

https://developer.apple.com/library/content/samplecode/MessageComposer/Introduction/Intro.html

But the result is the same. Is there something or some kind of tweak I'm missing to optimize the code for Xcode 6

Here is the code: in action buttons

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@"Hello from California!"]; // Set up recipients NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"]; NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil]; NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"]; [picker setToRecipients:toRecipients]; [picker setCcRecipients:ccRecipients]; [picker setBccRecipients:bccRecipients]; // Attach an image to the email NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"jpg"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"]; // Fill out the email body text NSString *emailBody = @"It is raining in sunny California!"; [picker setMessageBody:emailBody isHTML:NO]; [self presentViewController:picker animated:YES completion:NULL]; 

email delegate

 self.feedbackMsg.hidden = NO; // Notifies users about errors associated with the interface switch (result) { case MFMailComposeResultCancelled: self.feedbackMsg.text = @"Result: Mail sending canceled"; break; case MFMailComposeResultSaved: self.feedbackMsg.text = @"Result: Mail saved"; break; case MFMailComposeResultSent: self.feedbackMsg.text = @"Result: Mail sent"; break; case MFMailComposeResultFailed: self.feedbackMsg.text = @"Result: Mail sending failed"; break; default: self.feedbackMsg.text = @"Result: Mail not sent"; break; } [self dismissViewControllerAnimated:YES completion:NULL]; 

result:

Email defragmentation automatically disappears with a result of 0, i.e. MFMailComposeResultCancelled

with error codes: MessageComposer [10993: 196902] viewServiceDidTerminateWithError: Error Domain = _UIViewServiceInterfaceErrorDomain Code = 3 "Operation could not be completed. (Error _UIViewServiceInterfaceErrorDomain 3.)" UserInfo = 0x7b93f7e0

and

2014-09-17 22: 04: 22.538 MessageComposer [10993: 205761] timeout barrier fences from com.apple.MailCompositionService

+51
ios objective-c xcode ios8
Sep 17 '14 at 16:20
source share
1 answer

In appearance, this is a problem only for the simulator. (iOS 8 simulator) The globalMailer approach works fine on devices.

If anyone encounters this problem, just check on a real device.

+103
Sep 23 '14 at 17:58
source share



All Articles