MFMailComposeViewController出现时有空白字段

时间:2021-08-09 11:51:20

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.

我有一个有趣的问题。我的邮件组合视图控制器只显示主题,没有正文或收件人。在代码中,我确实设置了所有这些字段,但不知何故只显示了subject。

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}

错误域=_UIViewServiceInterfaceErrorDomain Code=3 "操作无法完成。(_UIViewServiceInterfaceErrorDomain错误3)。”用户信息= 0 x7fec540454d0 {消息=服务连接中断}

Creating a "global" variable didn't help:

创建一个“全局变量”没有帮助:

@property (nonatomic, strong) MFMailComposeViewController *mailComposer;

@property (nonatomic, strong) MFMailComposeViewController *mailComposer;

1 个解决方案

#1


1  

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!!!

我也有同样的问题,可能是你在模拟器上遇到的这个问题只有新的Xcode 6。*请试用一下设备,它会工作的很好!!

#1


1  

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!!!

我也有同样的问题,可能是你在模拟器上遇到的这个问题只有新的Xcode 6。*请试用一下设备,它会工作的很好!!