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 [OK]私はそれを試みた '[自己dismissViewControllerAnimated:はい完了:^ { [self emailThem]; }];でも、それと同じことです。 – user717452
デバイスに電子メールアカウントが設定されていますか? –