さて、これはしばらくの間私を悩ませてきました...
私は確認しましたが、他のすべての質問/回答は非ARCプロジェクトに関するものです。
MFMCvcを提示し、メッセージをすぐにキャンセルすると、iPhoneでThread1:EXEC_BAD_ACCESSエラーメッセージが表示されます。iPadで正常に動作するか、少し置いておくと(たとえば、30秒以上)動作します
何かアドバイスはありますか?(タイマーを入れて、タイマーが切れるまで閉じない以外は?)
ところで、私はMFMessageComposeViewControllerでも同じことをしていて、iPhoneとiPadの両方で正常に動作します。
これがそれを提示するための私のコードです
if (([action isEqualToString:@"EMail"]) && contact.length>0)
{
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
if([MFMailComposeViewController canSendMail]) {
[mailViewController setSubject:@""];
[mailViewController setMessageBody:@"" isHTML:NO];
[mailViewController setToRecipients:[NSArray arrayWithObject:contact]];
[mailViewController setMailComposeDelegate:self];
[self presentModalViewController:mailViewController animated:NO];
}
}
そして、ここで私はそれを却下します
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Send EMail" message:@"EMail Has Been Cancelled"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
break;
case MFMailComposeResultFailed:
{
NSLog(@"Error");
}
break;
case MFMailComposeResultSent:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Send EMail" message:@"EMail Has Been Sent"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
break;
case MFMailComposeResultSaved:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Send EMail" message:@"EMail Has Been Saved"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
break;
default:
break;
}
[self dismissModalViewControllerAnimated:NO];
}