1
我想从UIAlertController按下按钮后拉起邮件撰写视图控制器。在模拟器中,当我尝试打开邮件时,我收到了正常的崩溃和错误消息,但在应用程序中,我什么都没有收到。没有控制器,没有崩溃,没有。这是代码。邮件撰写视图控制器不会从UIAlertController打开
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Email" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self emailThem];
[self dismissViewControllerAnimated:YES completion:^{
}];
}]];
-(void) emailThem {
NSLog(@"EMAIL");
MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
mail.mailComposeDelegate = self;
[mail setSubject:@"To P3 Media"];
[mail setMessageBody:@"Replace this text with your message for all the information you would like on P3 Media." isHTML:NO];
[mail setToRecipients:@[@"[email protected]"]];
[self presentViewController:mail animated:YES completion:NULL];
}
什么问题?
尝试把“[自我emailThem]”完成处理的内部驳回视图控制器之后。还要确保方法emailThem下的presentViewController正在用户界面线程上运行。 –
@SeanMcDonald好吧,我试过'[self dismissViewControllerAnimated:YES完成:^ {0} {0} {0} {self emailThem; }];但仍然是同样的事情。 – user717452
你有在设备上设置的电子邮件帐户吗? –