3
MFMailComposeViewController를 사용하는 데 문제가 있습니다. 다음은 기기에서 실행하려고 시도한 샘플 코드입니다. 의도적으로 5 초의 지연을 추가했습니다 (첨부 파일에 대한 파일 다운로드 경험을 시뮬레이션하기 위해). 이후 앱에서 "메일"컨트롤러를 제공합니다. 지연 중에 홈 버튼을 클릭하면 응용 프로그램을 백그라운드로 실행하고 5 초 전에 앱을 다시 시작하면 제목 필드가 비어 있고 메시지 본문의 값은 '메시지 1'이 아니라 '메시지 2'가됩니다 "앱을 최소화하고 5 초 후에 앱을 다시 시작하면 제목이 나타나지 않지만 본문은"메시지 1 "이 아니라"메시지 2 "가됩니다. 그 행동을 이해하도록 도와주세요.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];
});
}
감사합니다 여기 요