3
我遇到使用MFMailComposeViewController的问题。以下是我尝试在设备上运行的示例代码。我有意添加了5秒的延迟(仅用于模拟下载附件文件的体验),之后应用程序显示“邮件”控制器。在延迟期间,如果我们点击主页按钮,即使应用程序在后台运行并在5秒之前恢复应用程序,则主题字段将为空白,同时消息正文将具有值“消息1”而不是“消息2 “如果我们将应用程序最小化并在5秒后恢复应用程序,主题不会出现,但主体将是”message2“而不是”message 1“。你能帮我理解行为吗?问题使用MFMailComposeViewController
-(void) func:(MFMailComposeViewController *) mail
{
[mail setMessageBody:@"message 2" isHTML:NO];
[self presentModalViewController:mail animated:YES];
}
- (IBAction)action:(id)sender
{
MFMailComposeViewController * mail = [[MFMailComposeViewController alloc] init];
[mail setMailComposeDelegate:self];
[mail setMessageBody:@"message 1" isHTML:NO];
[mail setSubject:@"subject 1"];
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector:@selector(func:) withObject:mail afterDelay:5];
});
}
感谢