我正在尝试从UIAlertController按下按钮后拉出一个Mail compose视图控制器。在模拟器中,我得到正常的崩溃和错误消息,我总是在尝试打开邮件时进入模拟器,但在应用程序中,我什么都没得到。没有控制器,没有崩溃,没有。这是代码。
[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:@[@"p3media2014@gmail.com"]];
[self presentViewController:mail animated:YES completion:NULL];
}
有什么问题?
答案 0 :(得分:0)
试用此代码
[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:@[@"p3media2014@gmail.com"]];
dispatch_async(dispatch_get_main_queue(),^{
[self presentViewController:mail animated:YES completion:NULL];
});
}