gpt4 book ai didi

iphone - MFMailComposeViewController 不关闭

转载 作者:行者123 更新时间:2023-12-03 21:01:51 26 4
gpt4 key购买 nike

我使用MFMailComposeViewController向其他人发送邮件。单击按钮时,撰写表将打开,我可以输入收件人地址、主题、邮件正文。但点击发送按钮后,邮件页面没有关闭。

代码:

if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"My image"];


UIImage *myImage = [UIImage imageNamed:@"mobiletuts-logo.png"];
NSData *imageData = UIImagePNGRepresentation(myImage);


[mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@"Image"];
NSString *emailBody = @"Hi, my image";
[mailer setMessageBody:emailBody isHTML:NO];

[self presentViewController:mailer animated:YES completion:nil];
}

- (void)mailComposeController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
switch (result) {
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultSent:
break;
default:
break;
}

[self dismissViewControllerAnimated:YES completion:nil];
}

最佳答案

抱歉。忘记添加这些行。此行之后邮件工作

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissViewControllerAnimated:YES completion:nil];
}

关于iphone - MFMailComposeViewController 不关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17482950/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com