gpt4 book ai didi

ios - MFMailComposer toReceiptsText 延迟

转载 作者:搜寻专家 更新时间:2023-11-01 05:40:09 24 4
gpt4 key购买 nike

我正在使用 MFMailcomposeViewController 来实现邮件功能。但是当应用程序出现 MFMailComposeViewController 时,toReceipts 中的文本会延迟显示。为什么会这样?

if MFMailComposeViewController.canSendMail()
{
var mailPicker = MFMailComposeViewController()
mailPicker.mailComposeDelegate = self;
mailPicker.setSubject("hello");
mailPicker.setMessageBody(txtViewBody.text, isHTML: false);
mailPicker.setToRecipients(["aashish01cs@gmail.com"])

self.becomeFirstResponder();


presentViewController(mailPicker, animated: true, completion: {
println("Mail composer completion block")
});

}

最佳答案

我知道防止 MFMailComposeViewController 跳动呈现的唯一方法是使用私有(private) api 调用,但该应用程序将被拒绝...

    MFMailComposeViewController *mailComposeVC = [[MFMailComposeViewController alloc] init];
// do your setup here

UIViewController *internalComposeVC = (UIViewController *) [mailComposeVC.viewControllers firstObject];
// call private method to layout the view immediately
SEL privateSelector = NSSelectorFromString(@"_endDelayingCompositionPresentation");
if ([internalComposeVC respondsToSelector:privateSelector]) {
((void (*)(id, SEL))[internalComposeVC methodForSelector:privateSelector])(internalComposeVC, privateSelector);
}

// present the MFMailComposeViewController
[self presentViewController:mailComposeVC animated:TRUE completion:nil];

// while presenting force the controller to set the recipient immediately
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[internalComposeVC viewWillAppear:FALSE];
[internalComposeVC viewDidAppear:FALSE];
});

我只在 iOS 8 上测试过

关于ios - MFMailComposer toReceiptsText 延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31669202/

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