MFMailComposeViewController shows up with blank fields

441 views Asked by At

I have an interesting problem. My mail compose view controller shows up with just subject but no body or recipients. In the code I do set all those fields, but somehow only subject shows up.

Now this does happen in a callback block, but I am not sure why that has an effect on what gets populated.

        MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
        picker.mailComposeDelegate = self;
        [picker setSubject: @"test 12345"];

        // Set up recipients
        NSArray *toRecipients = [NSArray arrayWithObject:email];
        [picker setToRecipients:toRecipients];

        // Fill out the email body text
        NSString *emailBody = @"test 1234";
        [picker setMessageBody:emailBody isHTML:NO];
        [self presentViewController:picker animated:YES completion:nil];

I also get this error when I try to change any fields:

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7fec540454d0 {Message=Service Connection Interrupted}

Creating a "global" variable didn't help:

@property (nonatomic, strong) MFMailComposeViewController *mailComposer;

1

There are 1 answers

0
Ashvin On BEST ANSWER

I had same problem, may be you are facing this issue with simulator only with new Xcode 6.* Please try in device, it will work fine!!!